About checking each elements in a vector using if loop (some what...)
Show older comments
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 Comments
LEE Min Hsun
on 25 Jan 2018
Edited: LEE Min Hsun
on 25 Jan 2018
Stephen23
on 25 Jan 2018
If i is not defined what value do you expect it to have? (hint: think about complex numbers).
LEE Min Hsun
on 25 Jan 2018
Answers (0)
Categories
Find more on Debugging and Improving Code in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!