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

textread (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

[a, b, ...] = textread(file, format)

[a, b, ...] = textread(file, format, size)

Description

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.

Details

Examples

Inputs

Name Description
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.

Outputs

Name Description
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.

Details

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)

Examples

t = 0:1:pi;
fid = fopen('test.txt', 'w');
fprintf(fid, '%f\n', t);
fclose(fid);
a = textread('test.txt', '%f')

Related Topics

fprintf
fscanf


 

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