how to run a loop over an array with matrices and multiply each matrix with an other array?
Show older comments
I have an array
A = {[10,0,0,10,0,20,15] [0,10,10,15,0,0,20] [0,11,18,0,0,0,17] [0,14,0,17,0,10,0] [18,13,0,0,0,15,0] [0,10,0,0,0,10,15]}
B=<1x10 cell> where each cell is <7x3>matrix
B = <7x3 double> <7x3 double> <7x3 double> <7x3 double> <7x3 double> <7x3 double> <7x3 double> <7x3 double> <7x3 double> <7x3 double>
I want to get the product of each array of A with 1st array of B then apply the whole loop on every array of B and get the result in form of an array of 1x10 cell
I tried this:
[r1,c1]=size(B)
for i=1:c1
for j=1:6
C=A{j}*B{i};
C(C>1)=1;
total=(sum(C))-1;
end
total_movement{j}=movement
end
but this runs a very long loop with zero result..how can I better code it?
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!