Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
crop a matrix in diagonal direction

Subject: crop a matrix in diagonal direction

From: edward kabanyas

Date: 13 Sep, 2012 08:12:08

Message: 1 of 2

Hi all,

I would like to crop a matrix in certain direction, for example diagonal.

Suppose I have a matrix in lon-latitude spaces as:

data=rand(101,401);
lon=80:0.2:160; %degree east
lat=-10:0.2:10; % south to north

contourf(lon, lat, data);

Now I want to crop the data within the following boxs (diagonally oriented):

Start points of box:
(90E, 0) and (90E,2N)
TO end points of box:
(110E,4N) and (110E,6N)

Probably some friends here have such experience. Thanks for best help.

Edward

Subject: crop a matrix in diagonal direction

From: John D'Errico

Date: 13 Sep, 2012 13:51:08

Message: 2 of 2

"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message <k2s4go$5s0$1@newscl01ah.mathworks.com>...
> Hi all,
>
> I would like to crop a matrix in certain direction, for example diagonal.
>
> Suppose I have a matrix in lon-latitude spaces as:
>
> data=rand(101,401);
> lon=80:0.2:160; %degree east
> lat=-10:0.2:10; % south to north
>
> contourf(lon, lat, data);
>
> Now I want to crop the data within the following boxs (diagonally oriented):
>
> Start points of box:
> (90E, 0) and (90E,2N)
> TO end points of box:
> (110E,4N) and (110E,6N)
>
> Probably some friends here have such experience. Thanks for best help.
>
> Edward

help tril
help triu

John

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us