How can I split a matrix into N different parts?

4 vues (au cours des 30 derniers jours)
Mete Naz
Mete Naz le 12 Sep 2018
Commenté : ANKUR KUMAR le 13 Sep 2018
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 commentaires
jonas
jonas le 12 Sep 2018
Modifié(e) : jonas le 12 Sep 2018
What do you mean divide them? How do you want to store each part? Hint: an array must be rectangular.
Mete Naz
Mete Naz le 12 Sep 2018
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

Connectez-vous pour commenter.

Réponses (1)

ANKUR KUMAR
ANKUR KUMAR le 12 Sep 2018
Modifié(e) : ANKUR KUMAR le 12 Sep 2018
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 commentaires
Mete Naz
Mete Naz le 12 Sep 2018
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 le 13 Sep 2018
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Polar Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by