MATLAB: Convert cell to array cell2array I have a structure sp. How can I copy the content name into an arrray ? Its supposed to be an array of numbers. a = sp.name;a = sp(:).name; does not work Best Answer names = { sp.Name }will extract them into a single cell arraynums = cellfun( @str2double, names );will turn them to a numeric array. Or justcellfun( @str2double, { sp.Name } )as a one-line command. Related SolutionsMATLAB: Converting cell array to double A = { 'B 1'; 'B 12'; 'B123' }B=str2double(regexp(A,'\d+','match','once')) MATLAB: Combine a cell array of cell arrays to a single cell array NewCellArray = vertcat( ExistingCellArray{:} ); Related QuestionHow to combine cells in cell arrayDelete empty [] {1×7 cell} {1×2 cell}Manipulation of a cell array-
Best Answer