How to get one table instead of multiple tables.
Show older comments
this is my code
for i=1:100
num = randi([1 75], 1, 5);
ex_num = randi([1 15], 1 , 1);
x=sort(num);
s = horzcat(x, ex_num);
table(i,s(1),s(2),s(3),s(4),s(5),s(6),'VariableNames', {'iter' 'first' 'second' 'third' 'fourth' 'fifth' 'extra'}, 'RowNames' ,{'iteration'})
end
for i=1:100 num = randi([1 75], 1, 5); ex_num = randi([1 15], 1 , 1); x=sort(num); s = horzcat(x, ex_num); table(i,s(1),s(2),s(3),s(4),s(5),s(6),'VariableNames', {'iter' 'first' 'second' 'third' 'fourth' 'fifth' 'extra'}, 'RowNames' ,{'iteration'}) end
Once I run the code I get what I want, however, I get 100 separate tables instead just getting one continuous table.
1 Comment
Stephen23
on 3 Jun 2015
Although beginners love using table, it is much tidier and more robust to use cell2table or struct2table, rather than converting from list of workspace variables using table.
Using these functions significantly reduces workspace clutter and is much more robust!
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion 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!