MATLAB: How to extract a sub matrix B from a matrix A?

MATLABmatrixmatrix arraymatrix manipulation

Sir, I have a two dimensional matrix of dimension 129*135 say A(129,135) and the elements are basically for x-y plot where x=66.5:0.25:100 (129 POINTS); y=6.5:0.25:38.5 (135 POINTS); Now I want a sub matrix say for x=70:0.25:75 (21 POINTS) and y=20:0.25:25 (21 POINTS); say B(21,21). How can I get this new matrix B from the matrix A.Please help

Best Answer

B=A(15:35,55:75);
You can calculate the limits as
15=(70-66.5)/0.25+1
35=(75-66.5)/0.25
55=(20-6.5)/0.25+1
75=(25-6.5)/0.25
Best wishes
Torsten.