From: Nghia Le on 15 Apr 2010 21:57 Hi, I am new to medical imaging analysis and matlab. Here is what I am trying to solve, hope you can provide me some guidance: I am trying to segment an image into smaller blocks and analyze data those blocks individually. For example, I have a 20x20 image (grayscale) and I want to segment into four blocks and form a 3-dimensional matrix 5x5x16 that I call 'A' by using for loop and here is my test code: I=magic(20); for m=1:4; for n=1:4; vl=(m-1)*5+1; vh=(m-1)*5+5; hl=(n-1)*5+1; hh=(n-1)*5+5; A(:,:,:)=I(vl:vh,hl:hh) end end Here is my problem, I cannot get A to define in term of m and n. For example if I want to view block A(m=1 and n=3) it would show up I(1:5,11:15). I been searching for the correct code two days and yet to find the solution. Hope you can provide some guidance. Thank you in advanced.
|
Pages: 1 Prev: How to delete string from a list of cells Next: Help request: Image segmentation loop |