use rows of matrix sequentially in iterations
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Stephen23
2015 年 11 月 6 日
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.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!