Navigation

Operators and Keywords

Function List:

C++ API

dlmwrite.m File Reference


Functions

function dlmwrite (file, a, varargin) if(nargin< 2||!ischar(file)) print_usage()
 if (ischar(a)) precision
 while (i< length(varargin)) i
 if (strcmpi(varargin{i},"delimiter")) i
 elseif (strcmpi(varargin{i},"newline")) i
 if (strcmpi(newline,"unix")) new line
 elseif (strcmpi(newline,"pc")) new line
 elseif (strcmpi(newline,"mac")) new line
endif elseif (strcmpi(varargin{i},"roffset")) i
 elseif (strcmpi(varargin{i},"coffset")) i
 elseif (strcmpi(varargin{i},"precision")) i
 if (!strcmpi(class(precision),"char")) precision
endif elseif (strcmpi(varargin{i},"-append")) opentype
 elseif (strcmpi(varargin{i},"append")) i
 if (strcmpi(varargin{i},"on")) opentype
 elseif (strcmpi(varargin{i},"off")) opentype
else error ("dlmwrite: append must be \"on\" or \"off\".")
endif else if (i==1) delim
 elseif (i==2) r
else print_usage ()
 if (fid< 0) error(msg)
else if (r > 0) fprintf(fid
else repmat ([repmat(delim, 1, c+columns(a)-1), newline], 1, r))
endif if (iscomplex(a)) cprecision
endif if (c > 0) template
 b (1:2:end,:)
 b (2:2:end,:)
 fprintf (fid, template, b)
else fprintf (fid, template, a.')
endif fclose (fid)
 !dlmwrite (f,[1, 2;3, 4],'precision','%5.2f','newline','unix','roffset', 1,'coffset', 1)
 !fclose (fid)
 !dlmwrite (f,[5, 6],'precision','%5.2f','newline','unix','coffset', 1,'delimiter',',','-append')
 !unlink (f)
 !assert (f1,",,\n, 1.00, 2.00\n, 3.00, 4.00\n")
 !assert (f2,",,\n, 1.00, 2.00\n, 3.00, 4.00\n, 5.00, 6.00\n")

Variables

endif delim = ","
 r = 0
 c = 0
 newline = "\n"
else precision = "%.16g"
endif opentype = "wt"
 i = 0
endif endif endwhile [fid, msg] = fopen (file, opentype)
else s
 template
 b = zeros (2*rows(a), columns (a))
endif endfunction!test !f = tmpnam()
 !fid = fopen(f,"rt")
 !f1 = char(fread(fid,Inf,'char')')
 !f2 = char(fread(fid,Inf,'char')')

Function Documentation

!assert ( f2  ,
,
n,
1.  00,
2.00\  n,
3.  00,
4.00\  n,
5.  00,
6.00\n"   
)

!assert ( f1  ,
,
n,
1.  00,
2.00\  n,
3.  00,
4.00\n"   
)

!dlmwrite ( ,
'precision ,
'%5.2f'  ,
'newline ,
'unix'  ,
'coffset'  ,
,
'delimiter'  ,
,
,
'-append'   
)

!dlmwrite ( ,
'precision ,
'%5.2f'  ,
'newline ,
'unix'  ,
'roffset'  ,
,
'coffset'  ,
 
)

!fclose ( fid   ) 

!unlink (  ) 

b ( 2:2:end  ,
 
)

b ( 1:2:end  ,
 
)

function dlmwrite ( file  ,
,
varargin   
)

elseif ( = =2  ) 

elseif ( strcmpi(varargin{i},"off")   ) 

elseif ( strcmpi(varargin{i},"append")   ) 

endif elseif ( strcmpi(varargin{i},"-append")   ) 

elseif ( strcmpi(varargin{i},"precision")   ) 

elseif ( strcmpi(varargin{i},"coffset")   ) 

endif elseif ( strcmpi(varargin{i},"roffset")   ) 

elseif ( strcmpi(newline,"mac")   )  [new]

elseif ( strcmpi(newline,"pc")   )  [new]

elseif ( strcmpi(varargin{i},"newline")   ) 

else error ( "dlmwrite: append must be \"on\" or \"off\"."   ) 

endif fclose ( fid   ) 

else fprintf ( fid  ,
template  ,
a.'   
)

fprintf ( fid  ,
template  ,
 
)

endif if ( ,
 
)

endif if ( iscomplex(a)   ) 

else if ( ,
 
)

if (  ) 

endif else if ( = =1  ) 

if ( strcmpi(varargin{i},"on")   ) 

if ( strcmpiclass(precision),"char"  ) 

if ( strcmpi(newline,"unix")   )  [new]

if ( strcmpi(varargin{i},"delimiter")   ) 

if ( ischar(a)   ) 

else print_usage (  ) 

else repmat ( ,
 
)

Type Constraints

while (  ) 


Variable Documentation

endif endfunction !test !f = tmpnam()

!f1 = char(fread(fid,Inf,'char')')

!f2 = char(fread(fid,Inf,'char')')

!fid = fopen(f,"rt")

b = zeros (2*rows(a), columns (a))

c = 0

delim = ","

i = 0

newline = "\n"

endif opentype = "wt"

precision = "%.16g"

r = 0

else s

Initial value:

 [precision, cprecision, "i", ...
                  repmat([delim, precision, cprecision, "i"], 1, ...
                  columns(a) - 1), newline ]