Owning Class: support
Requires: MathScript RT Module
c = fprintf(format, a)
c = fprintf(fid, format, a)
c = fprintf(format, b, ...)
c = fprintf(fid, format, b, ...)
Formats data as text and writes the text to a file.
| 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. |
| Name | Description |
|---|---|
| c | Returns the amount of data that LabVIEW writes successfully to the file specified by fid. c is a positive integer. |
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) |
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);