Thread Subject: { } ---> [ ]

Subject: { } ---> [ ]

From: ching l

Date: 22 Jul, 2008 10:45:08

Message: 1 of 6

is it possible to grab/convert the value in the cell array?

s= {[1 2 3] [3 4 5]}

so that it becomes

s= [1, 2, 3; 3, 4, 5]

Subject: { } ---> [ ]

From: Ashwini Deshpande

Date: 22 Jul, 2008 11:01:12

Message: 2 of 6

"ching l" <chinglnc@hotmail.com> wrote in message
<g64dnk$rkh$1@fred.mathworks.com>...
> is it possible to grab/convert the value in the cell array?
>
> s= {[1 2 3] [3 4 5]}
>
> so that it becomes
>
> s= [1, 2, 3; 3, 4, 5]

help cell2mat

HTH,
Ashwini

Subject: { } ---> [ ]

From: Felipe Orihuela-Espina

Date: 22 Jul, 2008 11:03:08

Message: 3 of 6

"ching l" <chinglnc@hotmail.com> wrote in message
<g64dnk$rkh$1@fred.mathworks.com>...
> is it possible to grab/convert the value in the cell array?
>
> s= {[1 2 3] [3 4 5]}
>
> so that it becomes
>
> s= [1, 2, 3; 3, 4, 5]


Try cell2mat

cheers

FOE

Subject: { } ---> [ ]

From: Yumnam Kirani Singh

Date: 22 Jul, 2008 11:36:17

Message: 4 of 6

Simply we can try the foloowing trick
>>m=[s{1,1};s{1,2}]
m =

     1 2 3
     3 4 5

Subject: { } ---> [ ]

From: Bruno Luong

Date: 22 Jul, 2008 11:52:01

Message: 5 of 6

or

cat(1,s{:})

% Bruno

Subject: { } ---> [ ]

From: Loren Shure

Date: 22 Jul, 2008 11:56:57

Message: 6 of 6

In article <g64dnk$rkh$1@fred.mathworks.com>, chinglnc@hotmail.com
says...
> is it possible to grab/convert the value in the cell array?
>
> s= {[1 2 3] [3 4 5]}
>
> so that it becomes
>
> s= [1, 2, 3; 3, 4, 5]
>

s = {[1 2 3] [4 5 6]}
snew = [s{:}]
s =
    [1x3 double] [1x3 double]
snew =
     1 2 3 4 5 6


--
Loren
http://blogs.mathworks.com/loren/

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
cell aray ching l 22 Jul, 2008 06:50:07
bracket ching l 22 Jul, 2008 06:50:07
rssFeed for this Thread

Contact us at files@mathworks.com