Restructure array

1 view (last 30 days)
Mariam Osmann
Mariam Osmann on 16 Oct 2011
How can I reorganize the following array?
A= [m1; m2][n1; n2; n3][p1; p2; p3][q1; q2; q3; q4]
into
B =[m1; n2; p1; q1][m2; n2; p2; q2][n3; p3; q3][q4]
Thank you

Accepted Answer

Walter Roberson
Walter Roberson on 16 Oct 2011
Unless those variables indicate vectors or arrays with harmonious sizes, neither of those arrays is allowed: numeric arrays cannot be varying length.
What do you intend your notation for A to mean? The notation you give is not valid MATLAB notation. Are you trying to indicate a 3 dimensional array, such as would be formed by
cat(3, [m1;m2], [n1;n2;n3], [p1;p2;p3], [q1;q2;q3;q4])
(but only if the sizes happen to match up) ?
  1 Comment
Mariam Osmann
Mariam Osmann on 28 Oct 2011
Thank you, I have added empty cells, to get equal sized arrays. and I remove them just before the plot function.

Sign in to comment.

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!