function c = owuitools_text_cell (value, fname, argname) %OWUITOOLS_TEXT_CELL Normalise char / cellstr input for the shims. % % Shared by the text shims in this directory. Returns a cell array of % char rows, and refuses anything else by name so the message reads % like the function the caller actually wrote. % % The name is prefixed rather than generic because this directory sits % ahead of everything on the path: a file called `text_cell.m` here % would shadow anyone's own helper of that name, in their own script, % with no way for them to see why. if (ischar (value)) if (ndims (value) > 2 || (~isempty (value) && rows (value) > 1)) error ('%s: %s must be a single row of characters, not a char matrix', fname, argname); end c = {value}; elseif (iscellstr (value)) c = value; elseif (iscell (value)) error ('%s: %s must be text - a char row or a cell array of char rows', fname, argname); else error ('%s: %s must be text, not %s', fname, argname, class (value)); end end