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 commentaires

Stephen23
Stephen23 le 25 Jan 2018
Modifié(e) : Stephen23 le 25 Jan 2018
@LEE Min Hsun: What is i, and where is it defined?
LEE Min Hsun
LEE Min Hsun le 25 Jan 2018
Modifié(e) : LEE Min Hsun le 25 Jan 2018
i is refer to elements in vectors(d,t,x,y), and it's not defined.
If i is not defined what value do you expect it to have? (hint: think about complex numbers).
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...?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Debugging and Improving Code dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by