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

 Respuesta aceptada

Voss
Voss el 26 de Oct. de 2022
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

Más respuestas (1)

the cyclist
the cyclist el 26 de Oct. de 2022

0 votos

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?

Categorías

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 26 de Oct. de 2022

Respondida:

el 26 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by