Home > utils > convert_charfld2cellstrfld.m

convert_charfld2cellstrfld

PURPOSE ^

Converts character array fields of a structure to cell arrays of strings

SYNOPSIS ^

function st = convert_charfld2cellstrfld(st)

DESCRIPTION ^

 Converts character array fields of a structure to cell arrays of strings

 st = convert_charfld2cellstrfld(st);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003