use rows of matrix sequentially in iterations

1 view (last 30 days)
Hi I have 2 matrices A and B. each of them has 4 rows and 10 columns. Also, I have the other matrix (D) 100 rows, 100 columns and 6 in third dimension. this matrix is (0-1)matrix. I want to use A and B as index. In fact, my code is something like that:
for it = 1:30
p = randi(80,100,100,6)
for k=1:4
IDX=A(k,:)
JDX=B(k,:)
end
for i:IDX
for j=JDX
s=find(D(i,j,:)==1)
t=s.*p
end
end
end
I hope that in each iteration 100 values for s are determined. and in each iteration one row of A and one row of B are used as IDX and JDX respectively. I mean in iteration 1 for example the first row of A and B, for iteration two the second row of A and B and for iteration 3 the third row and column of A and B. Thank you.
  2 Comments
Stephen23
Stephen23 on 6 Nov 2015
Today I formatted your code for you, but in future please do it yourself by selecting the code text and clicking the {} Code button.
Also its helps everyone (yourself included) when you use consistent indentation, like I edited your code to have.
fatema saba
fatema saba on 6 Nov 2015
Thank you Stephen.I try do that. Thanks

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!