This gives a 64×1 column vector in Mathematica:
F := Flatten[ArrayFlatten[
ArrayFlatten[
Table[Subscript[f, i, j, k, l, m,
n], {i, 0, 1}, {l, 0, 1}, {j, 0, 1}, {m, 0, 1}, {k, 0, 1}, {n,
0, 1}]]]] // MatrixForm
as F=(1:64)' does in MATLAB.
In MATLAB, reshape(F,16,4) gives a 16×4 matrix, where column 1 is the first 16 elements of F, column 2 the 17th to 32nd, etc.
In Mathematica, the best equivalents for reshaping seem to be the top two answers here.
But when I apply either of these commands, I do not get a 16×4 matrix that's constructed like reshape in MATLAB. Instead I get a 16×4 matrix where row 1 is the first four elements of F, etc.
I have tried adding transpose operations in every location imaginable, and still can't get my Mathematica output to match the MATLAB. I've also tried wrapping List[] around the definition of F to make F appear like a row instead of a column, but everything I do seems to not work.
Any help is much appreciated!
Comments
Post a Comment