Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

fprintf (MathScript RT Module Function)

LabVIEW 2011 MathScript RT Module Help

Edition Date: June 2011

Part Number: 373123B-01

»View Product Info

Owning Class: support

Requires: MathScript RT Module

Syntax

c = fprintf(format, a)

c = fprintf(fid, format, a)

c = fprintf(format, b, ...)

c = fprintf(fid, format, b, ...)

Description

Formats data as text and writes the text to a file.

Examples

Inputs

Name Description
fid Specifies the identifier for the file you want to write. Use the fopen function to open a file and assign it an identifier. fid is an integer. If you do not specify fid, fprintf formats data as text and displays the context of this text.
format Specifies the format in which to write text to the file. format must use the appropriate format specifier syntax. format is a string.
a Specifies the data you want to write to the file specified by fid. a is a vector or matrix.
b Specifies the data you want to write to the file specified by fid. b is a scalar or a string.

Outputs

Name Description
c Returns the amount of data that LabVIEW writes successfully to the file specified by fid. c is a positive integer.

Details

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT No (affects entire script)

Examples

t = 0:0.1:pi;
x = sin(t);
fid = fopen('test.dat', 'w');
c = fprintf(fid, '%f\n', x);
c = fprintf(fid, '%s = %f\n', 'sin(pi)', sin(pi));
fclose(fid);

Related Topics

fclose
fopen
fscanf
fseek
fwrite
sprintf
textread


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit