Grouping set of numbers with different size of rows
1 view (last 30 days)
Show older comments
Hi all,
I would like to group set of numbers into a container that I can use later in for loops: The first column are the set numbers. Example:
groupNum=[
1 61 32 624 15 2000;
2 25 3 635;
3 19 20 49 30;
4 56 28;
5 29 51 60;
]
for i=1: size(groupNum,1) % for 1 to 5 in this case
for i=1: size(groupNum,2) % for 1 to number of column in the set
%do something
end
end
That code will result in error because the size of the matrix is not consistent. Any advice would be much appreciated.
Thanks in advance.
2 Comments
Answers (1)
Jan
on 8 Dec 2017
Maybe:
groupNum = {1, [61 32 624 15 2000]; ...
2, [25 3 635]; ...
3, [19 20 49 30]; ...
4, [56 28]; ...
5, [29 51 60]}
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices 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!