Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Call matrix for multiplication

1 回表示 (過去 30 日間)
Fariba
Fariba 2012 年 8 月 15 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have 12 matrix: p1................p12.
these are loaded in matlab.
I wish to do p1'*P1 then p1'*p2 .......P1'*p12.
Then reapeat with p2: p2'*p3 ...........p2'*p12.
I wish to cinstruct a loop
for i=1:12
for j=i:12
pp(:,:,j)=Pi ?????????*Pj??????????
would you please let me know , how i can call pi and pj
regards

回答 (3 件)

Andrei Bobrov
Andrei Bobrov 2012 年 8 月 15 日
編集済み: Andrei Bobrov 2012 年 8 月 15 日
% 1. Your matrices (p1 .. p12):
for j1 = 1:12
eval(['p',num2str(j1),' = randi(10,3,4)']);
end
% 2. Solution:
p = eval(['{',sprintf('p%d,',(1:12)'),'}']);
n = nchoosek(1:12,2);
pp = zeros([size(p{1},2)*[1 1],size(n,1)]);
for j1 = 1:size(n,1)
pp(:,:,j1) = p{n(j1,1)}'*p{n(j1,2)};
end

Walter Roberson
Walter Roberson 2012 年 8 月 15 日

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 15 日
編集済み: Azzi Abdelmalek 2012 年 8 月 16 日
n=3;m=6;
for k = 1:12
p{k} = rand(n,m)
end
ind = nchoosek(1:12,2);pp=cell2mat(p(ind));
for k=1:n:size(pp,1)
result(:,:,(k+n-1)/n)=pp(k:k+n-1,1:m)'*pp(k:k+n-1,m+1:2*m)
end
  2 件のコメント
Fariba
Fariba 2012 年 8 月 15 日
I have find a soultion as following: for k=1:12 % load(['G:\......\G',num2str(k),'.txt']); f(:,:,k)=load(['G:\.......\G',num2str(k),'.txt']); end Thank you for all.
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 15 日
how is that related to your question?

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by