MATLAB: How to convert a cell array of structures to array of structures

cell array of structuresDatabase Toolboxstructure array

searchNode's nodeinfo is a cell array of structures.
nodeinfo = searchNode(neo4jconn, 'Comment')
nodeinfo.NodeData contains node data. It has a property key 'text'
>> nodeinfo.NodeData{1}.text
ans =
blahblah
Array of structures would be easier to work with and accesses can be vectorized
Please suggest a better than for loop:
s = size(nodeinfo.NodeData, 1);
for i = 1:s
comments(i).text = nodeinfo.NodeData{i}.text;
end
For example to collect text of all comments is now one-liner
text = [comments.text]
How can a cell array of structures be vectorized like that?

Best Answer

As long as the structures in the cells have all the same fields and that these structures in the cells are either scalar or arrays with the same number of rows:
nodedata = [nodeinfo.NodeData{:}];
%or
nodedata = cell2mat(nodeinfo.NodeData);