How to convert a cell array of structures to array of structures
Show older comments
nodeinfo = searchNode(neo4jconn, 'Comment')
nodeinfo.NodeData contains node data. It has a property key 'text'
>> nodeinfo.NodeData{1}.text
ans =
blahblah
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?
Accepted Answer
More Answers (1)
Categories
Find more on Cell Arrays in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!