From help-request at octave dot org Sat Jan 1 22:51:00 2005 Subject: Re: Matlab Script Files From: Paul Kienzle To: "Hubert Fitch" Cc: "Help Octave" Date: Sat, 1 Jan 2005 23:52:58 -0500 Hubert, The first arg. to fprintf needs to be the unit number returned from an fopen call, or a string if printing to standard output. You can also print to stdout or stderr. If you are on a unix-like system (including cygwin) you can use sed to transform your files: mkdir trans for f in *.m ; do sed -e"s/fprintf = *[(]'pri*[0-9]',/fprintf(stdout,/g"=20 < $f > trans/$f; done The files in the directory trans should contain proper fprintf=20 statements. - Paul On Dec 31, 2004, at 1:29 PM, Hubert Fitch wrote: > ------------------------------------------------------------ > Examples of formatted print sttements. > =A0 > fprintf('pri0',' mass_electron=A0=A0=A0=A0=A0=A0=A0=A0=A0 = %18e',mass_electron); > fprintf('pri0','=A0 kilograms \n') > > fprintf('pri0',' space_impedance=A0=A0=A0=A0=A0=A0=A0 = %18e',space_impedance); > fprintf('pri0','=A0 Ohms \n') > > % unitsx.m=A0=A0 > fprintf('prifile0','filename=3Dunits.m=A0=A0=20 > UNITS/DIMENSIONS/Definitions=A0=A0=A0 \n\n'); > fprintf('prifile0','Newton =3D Force=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=20 > kg*meter/sec^2 \n'); ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------