Wednesday, December 22, 2010

num2strcell

function mystrcel=num2strcell(mynum,GFmat)
% to convert a numeric array into a string cell
% usage:
%           mystrcel=num2strcell(YouNumArray,Digit.Format);
%  e.g.,  mystrcel=num2strcell(0.1:0.1:0.5,'%3.2f');
%  copyright by http://scriptdemo.blogspot.com

[nrow,ncol]=size(mynum);
for nj=1:nrow
      for ni=1:ncol
            mystrcel{nj,ni}=num2str(mynum(nj,ni),GFmat);
      end
end

No comments:

ShowCalendar