How to combine 2 for loops
Show older comments
Hi, I have
id = [ 1 3; 2 6; 3 2; 4 5; 5 1; 6 4; 7 7];
I will get two new_ids by sorting its column,
for col=1:c
new_id{col}=sortrows(id,col);
end
I want to get 2 results from each of the new_id respectively. This means that I will have in total 4 results.
for m=1:2
result{m}=id(m:m+1,:);
end
How can i combine all this? Thank you.
3 Comments
David Sanchez
on 5 Jun 2014
It is not very clear what you want to achieve. Could you please give an example or try to explain it in a different way?
Grace
on 5 Jun 2014
Accepted Answer
More Answers (0)
Categories
Find more on Array Geometries and Analysis 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!