Thread Subject: cushion the matrix

Subject: cushion the matrix

From: Diego Lass

Date: 4 Sep, 2009 04:10:19

Message: 1 of 2

Hi
I want to cushion the matrix
ex

a =
1 2 3
4 5 6

into

b =
0 0 0 0
0 4 5 6

what is the most efficient way to do this?

thanks
Diego

Subject: cushion the matrix

From: us

Date: 4 Sep, 2009 05:52:02

Message: 2 of 2

"Diego Lass" <dlISCool@gmail.com> wrote in message <h7q3vb$cet$1@fred.mathworks.com>...
> Hi
> I want to cushion the matrix
> ex
>
> a =
> 1 2 3
> 4 5 6
>
> into
>
> b =
> 0 0 0 0
> 0 4 5 6
>
> what is the most efficient way to do this?
>
> thanks
> Diego

one of the many solutions

     clear a b;
     a=[
          1 2 3
          4 5 6
     ];
     b(2:3,2:4)=a;

us

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
code us 4 Sep, 2009 01:54:06
linear indexing us 4 Sep, 2009 01:54:06
rssFeed for this Thread

Contact us at files@mathworks.com