Documentation of write_list


Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)


Function Synopsis

list = write_list ( y, ndigit ) ;

Help text

 function list = write_list ( y, ndigit ) ;

 
 Writes the variable "y" out as strings of length "ndigit"

 This routine was probably written by Alexis Lau (there was
 no documentation).

 ----------------------------------------------------

 I replaced the statement "elseif round(fmt) == fmt" with
 "elseif round(ndigit) == ndigit", which makes sense.  
 
 The inconsistency of the previous version of this code causes
 a MATLAB version 5 error.

 ---------------------------------------- Todd Mitchell, July 1997

Cross-Reference Information

This function is called by

Listing of function write_list

function list = write_list ( y, ndigit ) ;

if ( nargin < 2 ); ndigit=5; end;
[m,n] = size(y);

if isstr(ndigit);
  fmt = ndigit;
elseif round(ndigit) == ndigit;
  fmt = [ '%' int2str(ndigit) 'g' ];
else
  fmt = [ '%' num2str(ndigit) 'g' ];
end

list = sprintf(fmt,y(1));
for i = 2 : m*n;
  list = [ list sprintf(fmt,y(i)) ];
end;