Adding rows as a column

3 ビュー (過去 30 日間)
ibrahim kovan
ibrahim kovan 2022 年 10 月 26 日
回答済み: Voss 2022 年 10 月 26 日
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

採用された回答

Voss
Voss 2022 年 10 月 26 日
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 日
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?

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by