If I have 512 matrices (entries of each matrix is looping modulo 2), how the multiplication syntax for those 512*512 matrices ?

1 view (last 30 days)
Regita Agustin Wahyu F
Regita Agustin Wahyu F on 11 Jan 2022
Edited: Torsten on 13 Jan 2022
this is syntax for define the 512 matrices
clc,clear;
i=0;
modulo=2;
for A=1:modulo
for B=1:modulo
for C=1:modulo
for D=1:modulo
for E=1:modulo
for F=1:modulo
for G=1:modulo
for H=1:modulo
for I=1:modulo
M=[A-1 B-1 C-1 ; D-1 E-1 F-1 ; G-1 H-1 I-1];
i=i+1;
end
end
end
end
end
end
end
end
end
i
  5 Comments
Torsten
Torsten on 13 Jan 2022
On my PC, it works fine.
Maybe you changed "m" ?
Then you also have to change the size of the reshaped matrix accordingly:
A = reshape(justRows(i,:),[sqrt(m),sqrt(m)]);
If the error persists, include the code you are using together with the exact error message you receive.

Sign in to comment.

Answers (1)

Torsten
Torsten on 12 Jan 2022
Edited: Torsten on 12 Jan 2022
m = 9;
justRows = dec2bin(0:2^m-1)-'0';
for i = 1:size(justRows,1)
A = reshape(justRows(i,:),[3,3]);
M{i} = A;
end

Tags

Community Treasure Hunt

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

Start Hunting!