フィルターのクリア

Regarding Reshape of matrices and saving all of them in workspace

2 ビュー (過去 30 日間)
Sk. Sarif Hassan
Sk. Sarif Hassan 2014 年 8 月 25 日
編集済み: Andrei Bobrov 2014 年 8 月 25 日
n=16;
D = [0:2^n]';
B = rem(floor(D*pow2(-(n-1):0)),2);
for i=1:2^n
C=reshape(B(i,:),4,4);
end
end
I want to save all the square matrices of order 4 in matlab workspace. But the code I have written saves the last one only. Please help me in getting saved all the matrices.

採用された回答

Andrei Bobrov
Andrei Bobrov 2014 年 8 月 25 日
編集済み: Andrei Bobrov 2014 年 8 月 25 日
n=16;
D = [0:2^n]';
B = rem(floor(D*pow2(1-n:0)),2);
C = zeros(4,4,numel(D));
for ii=1:2^n
C(:,:,ii)=reshape(B(ii,:),4,4);
end
or
n=16;
D = [0:2^n]';
B = rem(floor(D*pow2(1-n:0)),2);
C = reshape(B.',4,4,[]);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by