comparison scripts/io/textread.m @ 11469:c776f063fefe

Overhaul m-script files to use common variable name between code and documentation.
author Rik <octave@nomad.inbox5.com>
date Sun, 09 Jan 2011 12:41:21 -0800
parents 2c356a35d7f5
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
11468:e1edf0ba3bcb 11469:c776f063fefe
34 ## @end itemize 34 ## @end itemize
35 ## The first @var{value} number of lines of @var{str} are skipped. 35 ## The first @var{value} number of lines of @var{str} are skipped.
36 ## @seealso{strread, load, dlmread, fscanf} 36 ## @seealso{strread, load, dlmread, fscanf}
37 ## @end deftypefn 37 ## @end deftypefn
38 38
39 function varargout = textread (filename, formatstr = "%f", varargin) 39 function varargout = textread (filename, format = "%f", varargin)
40 ## Check input 40 ## Check input
41 if (nargin < 1) 41 if (nargin < 1)
42 print_usage (); 42 print_usage ();
43 endif 43 endif
44 44
45 if (!ischar (filename) || !ischar (formatstr)) 45 if (!ischar (filename) || !ischar (format))
46 error ("textread: first and second input arguments must be strings"); 46 error ("textread: first and second input arguments must be strings");
47 endif 47 endif
48 48
49 ## Read file 49 ## Read file
50 fid = fopen (filename, "r"); 50 fid = fopen (filename, "r");
61 61
62 str = fread (fid, "char=>char").'; 62 str = fread (fid, "char=>char").';
63 fclose (fid); 63 fclose (fid);
64 64
65 ## Call strread to make it do the real work 65 ## Call strread to make it do the real work
66 [varargout{1:max (nargout, 1)}] = strread (str, formatstr, varargin {:}); 66 [varargout{1:max (nargout, 1)}] = strread (str, format, varargin {:});
67
67 endfunction 68 endfunction