Home > GLMdenoise > utilities > cell2str.m

cell2str

PURPOSE ^

function f = cell2str(m)

SYNOPSIS ^

function f = cell2str(m)

DESCRIPTION ^

 function f = cell2str(m)

 <m> is a 2D cell matrix with elements that are number-matrices or strings.

 return the string that can be evaluated to obtain <m>.

 example:
 a = {1 [5 6 7]; ':' 'df'};
 isequal(cell2str(a),'{ 1 [5 6 7]; '':'' ''df'';}')
 isequal(a,eval(cell2str(a)))

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function f = cell2str(m)
0002 
0003 % function f = cell2str(m)
0004 %
0005 % <m> is a 2D cell matrix with elements that are number-matrices or strings.
0006 %
0007 % return the string that can be evaluated to obtain <m>.
0008 %
0009 % example:
0010 % a = {1 [5 6 7]; ':' 'df'};
0011 % isequal(cell2str(a),'{ 1 [5 6 7]; '':'' ''df'';}')
0012 % isequal(a,eval(cell2str(a)))
0013 
0014 % do it row by row
0015 f = '{';
0016 for p=1:size(m,1)  % POTENTIALLY SLOW
0017   for q=1:size(m,2)
0018     f = [f ' ' mat2str(m{p,q})];
0019   end
0020   f = [f ';'];
0021 end
0022 f = [f '}'];

Generated on Fri 01-Aug-2014 12:03:17 by m2html © 2005