Hello,
I would like to add a new columns which consist of rows of the table:
As seen in the figures, I want to redesign my dataset in a dynamic way. Could you please help?
Thanks in advance

 采纳的回答

My guess:
% matrix as in 1.png:
data = reshape(1:21,3,[]).'
data = 7×3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
% new columns to be added:
new_data = (4:9)+3*(0:6).'
new_data = 7×6
4 5 6 7 8 9 7 8 9 10 11 12 10 11 12 13 14 15 13 14 15 16 17 18 16 17 18 19 20 21 19 20 21 22 23 24 22 23 24 25 26 27
% append the new columns to the end of data matrix:
data = [data new_data]
data = 7×9
1 2 3 4 5 6 7 8 9 4 5 6 7 8 9 10 11 12 7 8 9 10 11 12 13 14 15 10 11 12 13 14 15 16 17 18 13 14 15 16 17 18 19 20 21 16 17 18 19 20 21 22 23 24 19 20 21 22 23 24 25 26 27

更多回答(1 个)

the cyclist
the cyclist 2022-10-26

0 个投票

You really don't give enough detail about what you are trying to do. You are making us assume and/or guess too much. Maybe you want the reshape command?

类别

帮助中心File Exchange 中查找有关 Tables 的更多信息

产品

版本

R2020b

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by