Is the loop getting skipped? I wanted las to take last array of trk with a value in it. but for some the loop seems to get skipped.. What am I doing wrong? Can someone please help??
Show older comments
tk = 1;
trk = { [1;1], [1;1], [1;1], [1;1], [0;0], [0;0], [0;0]};
las =[];
if isempty(las)
las = [0;0];
for roll = 7:1
las = cell2mat(trk{tk,roll});
if (las(1,1) ~= 0) || (las(2,1) ~= 0)
break
end
end
end
OUTPUT
las =
0
0
roll =
[]
1 Comment
Image Analyst
on 13 Sep 2013
Edited: Image Analyst
on 13 Sep 2013
Original (earlier) version at http://www.mathworks.com/matlabcentral/answers/87176-is-the-loop-getting-skipped-i-wanted-las-to-take-last-array-of-trk-with-a-value-in-it-but-for-some (I answered the first version.)
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!