On 22/04/15 12:09, JokerOne wrote:

> Is there a one-line solution to count the entries of a cs-list, e.g.

>

>>>> a(1).b.c = [1;2];

>>>> a(2).b.c = [3;4;5];

>

> Now:

> desired_function_or_line(a.b.c)

> is suppose to yield :

> 5

I don't have a one-liner, but the following produces the result that I

think you want. Do note, however, that this sequence is not general as

it is *very* much dependent on knowing the exact shapes of your objects.

The underlying technique is nevertheless applicable in other, similar

situations.

ab = [ a.b ];

cnt = numel(vertcat(ab.c))

Sincerely,

--

Bård Skaflestad <

[hidden email]>

SINTEF ICT, Applied Mathematics

_______________________________________________

Help-octave mailing list

[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave