How can I split a matrix into N different parts?

4 次查看(过去 30 天)
Hey Guys, I have a matrix X (80,160), and I want to divide it in to 18 regions. You can find the regions specifications in the picture. I could divide them into 18 almost equal parts but that is not what I need.I actually could not figure out how to divide it into those kind of regions. I would appreciate if anybody can help. Thanks
  2 个评论
jonas
jonas 2018-9-12
编辑:jonas 2018-9-12
What do you mean divide them? How do you want to store each part? Hint: an array must be rectangular.
Mete Naz
Mete Naz 2018-9-12
I want to store them as sub matrices basically. If you look at the picture you will see how I want to divide them into 18 parts

请先登录,再进行评论。

回答(1 个)

ANKUR KUMAR
ANKUR KUMAR 2018-9-12
编辑:ANKUR KUMAR 2018-9-12
Firstly change data into polar coordinates, so that your complete data will change into angles and radius. After conversion, your data will be of dimension (360 [angles]* 100 [assumed as radius]) After this, you can easily crop data as your wish (as mentioned in your image).
You conversion will somewhat looks like
[xx,yy]=pol2cart(angle,radius);
z=interp2(lon,lat,data,xx,yy);
where 'lon', 'lat' is the x and y coordinates of your rectangular dataset ('data')
  2 个评论
Mete Naz
Mete Naz 2018-9-12
I have converted the data into polar coordinates. I am kind of new on matlab so I do not know How I am supposed to easily crop my data as shown in the picture? I would appreciate your help!
ANKUR KUMAR
ANKUR KUMAR 2018-9-13
After conversion into polar, your data will be in dimension of 360 * 100 (assuming angular resolution is 1 degree and radius has 100 units). As per your figure, suppose 1st part is around 60 to 120 degree and radius may be 66 to 100 units. Then simply do
A_cropped=A(60:120,66:100);
where A is the polar converted matrix.
The only hurdle in your problem is conversion. Once you are done with the conversion, it's very easy to crop the data as per your figure.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Polar Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by