About checking each elements in a vector using if loop (some what...)

Hello I'm new to MATLAB and I'd like to check an inputted array, which contain non-numeric elements and perform plotting, the code is as follow:
filename = 'HetCtxDIV1720164171motion.xls';
x = xlsread(filename,'D:D');
t = xlsread(filename,'C:C');
y = xlsread(filename,'E:E');
d = xlsread(filename,'B:B');
if isnumeric(d(i))
if isnumeric(t(i+2))
t1(i:i+600) = t(i+3:i+603);
x1(i:i+600) = x(i+3:i+603);
y1(i:i+600) = y(i+3:i+603);
tc = (t1)/(max(t1))
c = tc;
sz = 30;
scatter(x1,y1,sz,c,'filled');
colorbar('Ticks',[(0.1),(0.2),(0.3),(0.4),(0.5),(0.6),(0.7),(0.8),(0.9)],'TickLabels',
{'0.1','0.2','t=0.3','0.4','0.5','0.6','0.7','0.8','0.9*fulltime'})
end
end
however, output t1 is an empty vector...why?

4 件のコメント

Stephen23
Stephen23 2018 年 1 月 25 日
編集済み: Stephen23 2018 年 1 月 25 日
@LEE Min Hsun: What is i, and where is it defined?
LEE Min Hsun
LEE Min Hsun 2018 年 1 月 25 日
編集済み: LEE Min Hsun 2018 年 1 月 25 日
i is refer to elements in vectors(d,t,x,y), and it's not defined.
Stephen23
Stephen23 2018 年 1 月 25 日
If i is not defined what value do you expect it to have? (hint: think about complex numbers).
LEE Min Hsun
LEE Min Hsun 2018 年 1 月 25 日
seems like d(i) shall not exist cause there shall not have "i"th element in d, but isnumeric(d(i)) turn out to be true...?

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDebugging and Improving Code についてさらに検索

タグ

質問済み:

2018 年 1 月 25 日

コメント済み:

2018 年 1 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by