フィルターのクリア

Trouble finding end of a column in Matlab using xlsread

2 ビュー (過去 30 日間)
Joe
Joe 2012 年 5 月 14 日
The data i am reading in is in the form of an xls format so I use xlsread in matlab to read it in. The data is a mixture of numbers and letters. Due to this fact I use the raw format of xls read. The purpose of my program is to rearrange the data into a specified format.
My problem is that I am unable to find the correct end to a column when using a while loop.
One of my attempts is below:
while((alldata(i,4)~= 0)&&(i < (x-1)))
Temparray(i-6,3) = alldata(i,4);
xlswrite('output.xls',a,'Sheet1',sprintf('B%d',i-6));
xlswrite('output.xls',a,'Sheet1',sprintf('G%d',i-6));`enter code here`
i = i+1;
end
I wish it to stop when it reaches a blank cell or empty cell.
Any help would me much appreciated.
Thanks!
Joe

回答 (1 件)

Geoff
Geoff 2012 年 5 月 15 日
Do you mean this?
while( ~isempty(alldata{i,4}) && i < (x-1) )
  2 件のコメント
Joe
Joe 2012 年 5 月 16 日
Unfortunately that doesn't quite work because
it shows the the cells that I think of as empty all return
NaN.
Is is there a way to stop the loop if it returns NaN?
If it helps
this is how I call xlsread
<code>[numbers, words, alldata] = xlsread('April Test Results.xls');</code>
and these are the values of x and y
<code> [x,y] = size(alldata) </code>
Geoff
Geoff 2012 年 5 月 16 日
Use the isnan() functon to test for NaN.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by