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 comentarios

Stephen23
Stephen23 el 25 de En. de 2018
Editada: Stephen23 el 25 de En. de 2018
@LEE Min Hsun: What is i, and where is it defined?
LEE Min Hsun
LEE Min Hsun el 25 de En. de 2018
Editada: LEE Min Hsun el 25 de En. de 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...?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Debugging and Improving Code en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 25 de En. de 2018

Comentada:

el 25 de En. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by