FROM array of objects TO array of object's property

2 Ansichten (letzte 30 Tage)
Francisco Dias
Francisco Dias am 24 Nov. 2017
Beantwortet: Matt J am 24 Nov. 2017
Hi every one! my problem is the following:
I have a class "Actor" that as a "Name" and "Age" properties. Then I have an N-size array of them a(1:N) = Actor();
now I want to create a cell array of all the names of the Actors in the in the Actors array.
Is there a neat fast way of doing this?!

Akzeptierte Antwort

Matt J
Matt J am 24 Nov. 2017
nameCell={a.Name}

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by