MATLAB: Convert cell array to structure with first row as field names

cell arraysstructure

Hi, I have a cell array of 1800 X 920 where first 2 rows are characters. I would like to convert this to a structure with the first row as fields. How to do that?

Best Answer

Use cell2struct, possibly something like this (where C is your cell array):
S = cell2struct(C(2:end,:),C(1,:),1)