Access first element of cell array

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Access first element of cell array

LucaLuca
hi,

A{1}=[2 4];
A{2}=[4 6 7];


it's possible to access the first element ?

example:

the first element of A{1} is 2...The second element of A{1} is 4

i need to get element as number...not as string


thank you for helping



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

RE: Access first element of cell array

Windhorn, Allen E [ACIM/LSA/MKT]

> -----Original Message-----
> From: Help-octave [mailto:help-octave-
> bounces+allen.windhorn=[hidden email]] On Behalf Of LucaLuca
>
> A{1}=[2 4];
> A{2}=[4 6 7];
>
> it's possible to access the first element ?

Of what?  The first element of A is [2,4].

>> A{1}
ans =

   2   4

This is an array of numbers.

The first element of the first element of A is 2.

>> A{1}(1)
ans =  2

This is a number.

Regards,
Allen