Lionel Koh
Lionel Koh

Reputation: 199

returning first row in cell array matlab

I have a cell array like this,

priceList =
[61 x 1 double]    [ 11x1 double]

and in each of this arrays, I have some numbers for e.g.

5  4
4  3
2  1
1
2

so on and so forth, does anyone know how I can return the first row(first index of each array), which will be 5 and 4 in an array based on the above example so something like

result =
5
4

Any help is appreciated

Upvotes: 0

Views: 579

Answers (1)

paddy
paddy

Reputation: 63481

You can use cellfun:

result = cellfun( @(x) x(1), priceList )

Upvotes: 2

Related Questions