Owning Class: support
Requires: MathScript RT Module
a = fread(fid)
a = fread(fid, n)
a = fread(fid, n, type)
a = fread(fid, n, type, s)
a = fread(fid, n, type, s, byte)
[a, b] = fread(fid)
[a, b] = fread(fid, n)
[a, b] = fread(fid, n, type)
[a, b] = fread(fid, n, type, s)
[a, b] = fread(fid, n, type, s, byte)
Reads binary data from a file.
| Name | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| fid | Specifies the identifier for the file you want to read. Use the fopen function to open a file and assign it an identifier. fid is an integer. | ||||||||||||||||||||||||||||
| n | Specifies the amount of data to read from the file specified by fid. LabVIEW discards all but the first two elements of n. If n is inf, LabVIEW reads the file until it reads all the data or an error occurs. n is a 32-bit signed integer or a 1D matrix of those values. | ||||||||||||||||||||||||||||
| type | Specifies the data type to read from 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 after each m bytes it reads successfully. You also can add '=>' and a data type after type to specify the data type that LabVIEW returns. type is a string that accepts the following values.
|
||||||||||||||||||||||||||||
| s | Specifies the number of bytes to skip after each m bytes as you specify in type. s is a positive integer. | ||||||||||||||||||||||||||||
| byte | Specifies the byte order, or endian form, to use when reading data. byte is a string that accepts the following values.
|
| Name | Description |
|---|---|
| a | Returns the data that LabVIEW read from the file specified by fid. a is a vector or matrix of 64-bit, double-precision, floating-point numbers. |
| b | Returns the amount of data that LabVIEW read successfully from the file specified by fid. b 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 | Not characterized |
fid = fopen('test.dat', 'r');
[a, b] = fread(fid, [10, Inf], '10*int8=>int32', 5);
fclose(fid);