Convert Matlab struct array to cell array -
can matlab struct array converted cell array without iterating through array?
i want each struct in struct array become 1 cell in cell array. command struct2cell doesn't seem breaks out each field in struct separate cell.
this has been posted to:
try num2cell:
mystructcell = num2cell(mystruct);
for example:
>> mystruct(1).name = 'john'; >> mystruct(2).name = 'paul'; >> mystruct mystruct = 1x2 struct array fields: name >> mystructcell = num2cell(mystruct) mystructcell = [1x1 struct] [1x1 struct] >> mystructcell{1} ans = name: 'john' >> mystructcell{2} ans = name: 'paul' >> mystructcell{2}.name ans = paul
Comments
Post a Comment