fprintf

fprintf — Emulator of C language fprintf function

Calling sequence

fprintf(file,format,value_1,..,value_n)  

Parameters

format : a Scilab string. Specifies a character string combining literal characters with conversion specifications.
value_i : Specifies the data to be converted according to the format parameter.
str : column vector of character strings
file : a Scilab string specifying a file name or a logical unit number (see file)

Description

The fprintf function converts, formats, and writes its value parameters, under control of the format parameter, to the file specified by its file parameter.

The format parameter is a character string that contains two types of objects:

Literal characters: which are copied to the output stream.
Conversion specifications: each of which causes zero or more items to be fetched from the value parameter list. see printf_conversion for details

If any values remain after the entire format has been processed, they are ignored.

Examples



u=file('open','results','unknown') //open the result file
t=0:0.1:2*%pi;
for tk=t
 fprintf(u,'time = %6.3f value = %6.3f',tk,sin(tk)) // write a line
end
file('close',u) //close the result file
 
  

See also

string, print, write, format, disp, file, printf, sprintf