MATLAB: How to index a cell array

cell arraysMATLABstruct

Hi, I encountered a Matlab problem again. I want to access all struct field elements, which is an element of a cell array, at one time, not using loop. Such as:
s{1} = struct('ID',1,'other field',...);
s{2} = struct('ID',2,'other field',...);
I want to access all ID values in the cell s, I write the code like this:
IDs = [s{:}.ID];
This does not work, how to access all ID values not using for loop, please?

Best Answer

You can do this in Two steps
temp = [s{:}];
allIDValues = [temp.ID];