Extracting data from handle objects
Ältere Kommentare anzeigen
Hey, I have following problem.
I have multiple handle class objects which all have a propertie which can either be a scalar or a vector/matrix.
I now need a way to extract the last values of those vactors/matrices from all objects, so that they form a vector again.
So for example:
obj(1).value1=[1,2,3];
obj(1).value2=[0,0,0;0.1,0.2,0.3;0.9,0.8,0.7];
obj(2).value1=[1,2,3,4,5];
obj(2).value2=[0,0,0,0,0;0.9,0.7,0.8,0.6,0.5;0.1,0.2,0.3,0.4,0.5];
...
I now need to extract the data like
value1_vector=[3,5];
value2_vector=[0,0.3,0.7;0,0.5,0.5];
At the same time, these vectors/matrices have no fixed length and I dont know the length at the start. So it would be better to save same as a cell? Would that make the extracting of the values above easier?
Maybe a change in the size is not preferable when in future the code might be tranfered to a mexfile, where a size change while runtime is inmpossible.
Many thanks in advance
3 Kommentare
Catalytic
am 29 Nov. 2022
Strangely, it appears that you have asked 52 questions, but accepted answers to only 1 of them. Have you truly had such poor luck in getting useful answers?
Marc Laub
am 29 Nov. 2022
Rik
am 29 Nov. 2022
The best strategy for storing your data depends on what you want to do next.
Do not reject a solution with a loop out of hand. Loops are fast and are easy for Matlab (or a human) to translate to C(++).
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!