Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to compute the multiplication between matrix and matrix in different file

조회 수: 1 (최근 30일)
Laura
Laura 2015년 4월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
I have data that saves with different names such as data_1, data_2, etc...
data_1 will have a matrix A with dimension of 1140 x3201, data_2 will also have a matrix a with the same dimension as data_1 and of course, it has different number.
I want to calculate sum(sum(A(data_1).*A(data_2))), and then the next one would be sum(sum(A(data_2).*A(data_3))), etc..... Then put the answer together
Let says I have 10 files ( data_1, data_2, ..data_10)
Load the data file.
count=1;
for j=1:10
ss=strcat(path,data,'_',int2str(j),'.mat')
load(ss);
for i=1:1-j
B(count)=sum(sum(A(:,:,i).*A(:,:,i+1)));
count=count+1;
end
end
I could not get it to work. Can anyone give me an idea how to do so?
Thanks

답변 (1개)

Star Strider
Star Strider 2015년 4월 15일
I am not certain what you want to do, but correct this line to start:
B(count)=sum(sum(A(:,:,j).*A(:,:,j+1)));
^
Inserted Comma
  댓글 수: 2
Laura
Laura 2015년 4월 15일
편집: Laura 2015년 4월 15일
I saved matrix A under file name such as data_1, data_2, so on
What I want is to take the sum(sum(A(in the data_1).*A(in the data_2))), let say this answer is a
The next one is sum(sum(A(in the data_2).*A(in the data_3))) and this is b, so on.
then I want B=[a b, etc].
Star Strider
Star Strider 2015년 4월 15일
I have no idea what you are doing. Your description is too abstract for me to follow.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by