How can I permute a 3D magic matrix such that the largest element will be on page 3.
Show older comments
A1=[25 16 80 104 90;115 98 4 1 97;42 111 85 2 75;66 72 27 102 48;67 18 119 106 5];
A2=[91 77 71 6 70;52 64 117 69 13;30 118 21 123 23;26 39 92 44 114;116 17 14 73 95];
A3=[47 61 45 76 86;107 43 38 33 94;89 68 63 58 37;32 93 88 83 19;40 50 81 65 79];
A4=[31 53 112 109 10;12 82 34 87 100;103 3 105 8 96;113 57 9 62 74;56 120 55 49 35];
A5=[121 108 7 20 59;29 28 122 125 11;51 15 41 124 84;78 54 99 24 60;36 110 46 22 101];
A=cat(3,A1,A2,A3,A4,A5);
In this example the largest is on page 5
4 Comments
Geoff Hayes
on 25 Nov 2014
Peter - what is page 3, or page 5? Are you referring to a textbook?
PETER ADETOKUNBO
on 25 Nov 2014
Geoff Hayes
on 25 Nov 2014
Peter - so do you want all combinations of the 5 matrices such that the third will always have A5? So the following would be considered permutations of A
A1 A2 A5 A3 A4
A1 A2 A5 A4 A3
A1 A3 A5 A2 A4
A1 A3 A5 A4 A2
A1 A4 A5 A2 A3
A1 A4 A5 A3 A2
etc.
PETER ADETOKUNBO
on 25 Nov 2014
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!