Thread Subject: Get one dimension of a cell array

Subject: Get one dimension of a cell array

From: David Doria

Date: 2 Jun, 2008 13:36:01

Message: 1 of 2

I have this

A{dim1, dim2, dim3};

I want to do:

B = A{1,1,:}; %make B a 1D cell array containing all the
items in A with first index 1 and second index 1.

What happens though is just A{1,1,1} is assigned to B. Is
there a way to do this?

Thanks,

Dave

Subject: Get one dimension of a cell array

From: Devdatt Lad

Date: 2 Jun, 2008 13:55:34

Message: 2 of 2

"David Doria" wrote...
>I have this
>
> A{dim1, dim2, dim3};
>
> I want to do:
>
> B = A{1,1,:}; %make B a 1D cell array containing all the
> items in A with first index 1 and second index 1.
>
> What happens though is just A{1,1,1} is assigned to B. Is
> there a way to do this?

B = squeeze(A(1,1,:))

--
Devdatt Lad
The MathWorks, Inc.

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