Owning Class: support
Requires: MathScript RT Module
[a, b, ...] = textread(file, format)
[a, b, ...] = textread(file, format, size)
Reads text in a file and converts the text to an appropriate data type. The number of outputs must equal the number of conversion codes in format.
|file||Specifies the path to the file you want to read. If file is a relative path, LabVIEW searches for the file in the current working directory. file is a string.|
|format||Specifies the format in which to read text from the file. format must use the appropriate format specifier syntax. format is a string.|
|size||Specifies the amount of text to read from the file. If you do not specify size or if size is inf, LabVIEW reads from the file using the specified format until all the text is read or until an error occurs. size is a scalar.|
|a||Returns the text from the file according to the first conversion code in format. a is a vector or matrix of doubles or characters.|
|b||Returns the text from the file according to the second conversion code in format. b is a vector or matrix of doubles or characters.|
If you use this function in a stand-alone application or shared library and file is a relative path, LabVIEW searches for the file in the path where you installed the application or shared library. If file is an absolute path, LabVIEW searches for the file on the local machine or target at the specified location. (Real-Time Module) If you deploy this function to an RT target and file is a relative path, LabVIEW searches for the file in the path returned by the Default Data Directory VI.
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:1:pi;
fid = fopen('test.txt', 'w');
fprintf(fid, '%f\n', t);
a = textread('test.txt', '%f')