Converts character array fields of a structure to cell arrays of strings st = convert_charfld2cellstrfld(st);
0001 function st = convert_charfld2cellstrfld(st) 0002 % Converts character array fields of a structure to cell arrays of strings 0003 % 0004 % st = convert_charfld2cellstrfld(st); 0005 0006 % 18Nov2012 Petr Janata 0007 0008 fldnames = fieldnames(st); 0009 nfld = length(fldnames); 0010 for ifld = 1:nfld 0011 currFld = fldnames{ifld}; 0012 if ischar(st.(currFld)) 0013 st.(currFld) = cellstr(st.(currFld)); 0014 end 0015 end 0016 0017 end