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에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!