Sequence of submatrix based on the position of a rectangle
14 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 16 Oct 2011
Duplicate is at http://www.mathworks.com/matlabcentral/answers/17973-block-to-make-a-loop-to-find-a-sequence-of-submatrix
Answers (8)
Vincenzo
on 16 Oct 2011
2 Comments
Walter Roberson
on 16 Oct 2011
http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F
Image Analyst
on 16 Oct 2011
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
on 18 Oct 2011
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 Comments
Image Analyst
on 18 Oct 2011
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 Comments
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!