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

fwrite (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 = fwrite(fid, a)

c = fwrite(fid, a, type)

c = fwrite(fid, a, type, s)

c = fwrite(fid, a, type, s, byte)

Description

Writes binary data to a file.

Examples

Inputs

Name Description
fid Specifies the identifier for the file to which you want to write. Use the fopen function to open a file and assign it an identifier. fid is an integer.
a Specifies the data you want to write to the file specified by fid. a is a vector or matrix.
type Specifies the data type of a that you want to write to the file specified by fid. If you specify s, you can add a positive integer of the form 'm*' before type. LabVIEW then skips s bytes before each m bytes it writes to the file. type is a string that accepts the following values.

'double' Writes 64-bit, double-precision, floating-point numbers.
'float32' Writes 32-bit, single-precision, floating-point numbers.
'float64' Writes 64-bit, double-precision, floating-point numbers.
'int16' Writes 16-bit signed integers.
'int32' Writes 32-bit signed integers.
'int64' Writes 64-bit signed integers.
'int8' Writes 8-bit signed integers.
'schar' Writes signed characters.
'single' Writes 32-bit, single-precision, floating-point numbers.
'uchar' (default) Writes unsigned characters.
'uint16' Writes 16-bit unsigned integers.
'uint32' Writes 32-bit unsigned integers.
'uint64' Writes 64-bit unsigned integers.
'uint8' Writes 8-bit unsigned integers.
s Specifies the number of bytes to skip before each m bytes as you specify in type. s is a positive integer.
byte Specifies the byte order, or endian form, to use when writing data. byte is a string that accepts the following values.

'b' Writes data in big-endian form.
'l' Writes data in little-endian form.
'n' (default) Writes data in the byte-ordering format of the host computer.

Outputs

Name Description
c Returns the amount of data that LabVIEW wrote 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 Not characterized

Examples

fid = fopen('test.dat', 'w');
a = [-0.1, 0, 0.1; -0.2, 0.1, 0.4];
c = fwrite(fid, a, '4*float32', 2);
fclose(fid);

Related Topics

fclose
fopen
fread
fseek


 

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