Message Boards Message Boards

0
|
6136 Views
|
6 Replies
|
5 Total Likes
View groups...
Share
Share this post:

[?] Transfer 4 D matrix into 2 D matrix?

Posted 7 years ago

I would like to transfer the matrix above into a 4 by 4 matrix with the same order as ATTACHMENT blow. Please do not hard code it. I would like to see some functions to help me to overcome this problem thank you

Attachments:
POSTED BY: Sheng Dai
6 Replies
ArrayFlatten[a]

or

Flatten[a, {{1, 3}, {2, 4}}]  (* list of list of dimensions to merge *)
POSTED BY: Sander Huisman

ArrayFlatten is nice. I under-use that function...

Thanks

Marco

POSTED BY: Marco Thiel

I rarely use it actually, I go with Flatten generally. I think Flatten has all the functionality of ArrayFlatten 'inside it'…

POSTED BY: Sander Huisman

Hi Sander,

I guess you are right. I notice that I often use "more common", but perhaps more flexible commands to achieve inbuilt functionality. It's a little bit like with any other Language: The more proficient you are the more precise words you can actively use. That makes it more elegant.

So, I have got to go back to learning more Wolfram Language Vocabulary. The Wolfram Language is now at what - 6000+ "words"?In spoken languages one is proficient with a vocabulary of about 5000 words or so, albeit this being more complicated than that. You are expected to know about 500 words for a C2 level for "Cambridge Proficiency in English". I admit that the functions in Mathematica are somewhat different from words in a language, but there is often a fair amount of maths background required to fully appreciate them.

At school, we did "word-tournaments" where pupils would do a one-to-one fight, being asked words in a foreign language. The first not to know a given word would lose the battle. It might be interesting to write a little program in Mathematica to find out how large ones vocabulary is...

Cheers,

Marco

POSTED BY: Marco Thiel

Hi Sheng Dai,

is this what you are looking for?

a = {{{{"a", "b"}, {"c", "d"}}, {{"e", "f"}, {"g", "h"}}}, {{{"i", "j"}, {"k", "l"}}, {{"m", "n"}, {"o", "p"}}}};
Partition[Flatten[Transpose /@ a], 4] // MatrixForm

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 7 years ago

Thank you Marco, that is a great help. And thank you everyone.

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

Group Abstract Group Abstract