Sequence of submatrix based on the position of a rectangle
10 ビュー (過去 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!