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.
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...?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Debugging 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