How can I create this matrix ?

3 ビュー (過去 30 日間)
Akash Pal
Akash Pal 2021 年 8 月 16 日
回答済み: Chunru 2021 年 8 月 16 日
Let I have three matrix
A=26X5
B=26Xj
c=26Xj
where A matrix size is fixed but in B and C the column number can be varied .I want to find a new set of matrix where the matrices number will depending on the j value .If I take j value is 4 then I will get 4 set of matrix like X(j).So how I can get it in a loop?
As example
X1=[A B(:,1) C(:,1)];
X2=[A B(:,2) C(:,2)];
X3=[A B(:,3) C(:,3)];
X4=[A B(:,4) C(:,4)];

採用された回答

Chunru
Chunru 2021 年 8 月 16 日
A=rand(26, 5);
B=rand(26, 7);
C=rand(26, 8);
for i=1:4
X{i} = [A, B(:,i) C(:,i)];
end
X
X = 1×4 cell array
{26×7 double} {26×7 double} {26×7 double} {26×7 double}

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by