Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.7K Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Flatten array without loosing "structure"

Posted 3 years ago

Hello

I was wondering if there is a function to turn this matrix
enter image description here
into this matrix
enter image description here

Thanks in advance,
Tommaso

POSTED BY: Tommaso Peduzzi
5 Replies

ArrayFlatten[a] also works.

POSTED BY: Michael Rogers

I found this in the documentation for Flatten:

m = {{{{0, 0}, {0, 0}}, {{1, 0}, {0, 1}}}, {{{1, 0}, {0, 1}}, {{0, 
      0}, {0, 0}}}};
m // MatrixForm
Flatten[m, {{1, 3}, {2, 4}}] // MatrixForm
POSTED BY: Gianluca Gorni

Thank you for the replies. ArrayReshape did it for me!

POSTED BY: Tommaso Peduzzi
Posted 3 years ago

You want to look into ArrayReshape.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard