New to Matlab come from C/C++......
I have an array of objects and I'm trying to access the values of every single object in the array and concatenate them into one variable.
Class sample
properties(GetAccess = 'public', SetAccess ='public')
ID;
Value;
end
methods
function obj = sample(id, value)
obj.ID = id;
obj.Value = value;
end
end
end
Then I make an matrix containing some of the objects.
x = sample.empty(3,0);
x(1) = sample(1,3);
x(2) = sample(1,4);
x(3) = sample(1,5);
Then I want to get all the values from the objects and store them into a new array.
y = x(:).Value;
This however fails and only puts the value of x(3) into y..... and:
y(:) = x(:).Value;
Throws an error.
Any help would be appreciated. I know I could do this with loops but I'm trying to do it in the fastest and most efficient way.