Sequence of submatrix based on the position of a rectangle
조회 수: 14 (최근 30일)
이전 댓글 표시
I found the method to derive the submatrix (based on the position of the rectangle that I select through imagesc-> Insert-> rectangle) from the original matrix. Follow the link:
But now I have a sequence of matrices, not just one, and I should find the respective submatrices selecting only that rectangle. How can i do?
댓글 수: 3
Walter Roberson
2011년 10월 16일
Duplicate is at http://www.mathworks.com/matlabcentral/answers/17973-block-to-make-a-loop-to-find-a-sequence-of-submatrix
답변 (8개)
Vincenzo
2011년 10월 16일
댓글 수: 2
Walter Roberson
2011년 10월 16일
http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F
Image Analyst
2011년 10월 16일
I don't see a question. You've stated what you need, and given a solution to it in only 10 lines, so as I see it, you're all set.
Image Analyst
2011년 10월 18일
In (2), you're getting rows and columns confused. x is columns and y is rows. So this
row1=int32(x1*columns);
is meaningless. I have no idea what you're asking in (3). The code you tried to write in 2 should be put into an "m-file" with the text editor. Then you'd run that. .mat files are usually for storing data (variables) and never used for storing source code. Seems like you need to go through the Getting Started guide.
댓글 수: 0
Image Analyst
2011년 10월 18일
I don't think you can do this Seq{i}(row1:row2 ,column1:column2); first of all, you'd need to have Seq previously defined and created, which I don't think you have, based on the error message. Then, assuming you did stuff an array into Seq{i} I'd extract it like this
m = Seq{i}; sub{i} = m(row1:row2, column1:column2);
Finally, incrementing i (i=i+1) inside a for loop does nothing - it ignores it and follows the iteration set up on the "for" line. Changing the iterator ("i") inside the loop as no effect on the number of iterations that take place, as discussed in this forum before.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!