Thread Subject: sqeeze 2D arrays

Subject: sqeeze 2D arrays

From: Juliette Salexa

Date: 9 Jul, 2009 22:53:01

Message: 1 of 4

The sqeeze documentation says:

"Two-dimensional arrays are unaffected by squeeze"

if I have a 1x15 array, can I not squeze it inot a row vector of length 15 ??

this is because findstr only works when the input sting is one row.

Subject: sqeeze 2D arrays

From: Alan B

Date: 9 Jul, 2009 23:00:02

Message: 2 of 4

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h35scd$not$1@fred.mathworks.com>...
> The sqeeze documentation says:
>
> "Two-dimensional arrays are unaffected by squeeze"
>
> if I have a 1x15 array, can I not squeze it inot a row vector of length 15 ??
>
> this is because findstr only works when the input sting is one row.

You can use shiftdim, permute, transpose. If you might get a row OR column vector (or anything else), you can combine the single colon operator with transpose:
a(:)' % produces row vector regardless of size(a)

Subject: sqeeze 2D arrays

From: Matt Fig

Date: 9 Jul, 2009 23:11:02

Message: 3 of 4

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h35scd$not$1@fred.mathworks.com>...
> The sqeeze documentation says:
>
> "Two-dimensional arrays are unaffected by squeeze"
>
> if I have a 1x15 array, can I not squeze it inot a row vector of length 15 ??

I am confused. A 1x15 array IS a row vector of length 15. It is also 2D, so squeeze does nothing to it.

Subject: sqeeze 2D arrays

From: Juliette Salexa

Date: 9 Jul, 2009 23:12:02

Message: 4 of 4

I just realized that my question was made under false pretenses. Sorry about that.

"Alan B" <monguin61@yahoo.com> wrote in message <h35spi$kju$1@fred.mathworks.com>...
> "Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h35scd$not$1@fred.mathworks.com>...
> > The sqeeze documentation says:
> >
> > "Two-dimensional arrays are unaffected by squeeze"
> >
> > if I have a 1x15 array, can I not squeze it inot a row vector of length 15 ??
> >
> > this is because findstr only works when the input sting is one row.
>
> You can use shiftdim, permute, transpose. If you might get a row OR column vector (or anything else), you can combine the single colon operator with transpose:
> a(:)' % produces row vector regardless of size(a)

Tags for this Thread

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.

rssFeed for this Thread

Contact us at files@mathworks.com