ReadMATLABFile (FPScript)

21.09.2021

Reads a field from a file in MATLAB format.

Syntax

ReadMATLABFile(File, Indices, [ TransposeMatrix = FALSE ] [ , MatrixAsDataseries = TRUE ])

 

The syntax of the ReadMATLABFile function consists of the following parts:

Part

Description

File

String with the path of the MATLAB file to be read.

Permitted data structures are scalar value. Supported data types are string (file name).

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Indices

Index of field and optional element to be read out from the file. The first integer is the one-based index of the MATLAB field to be read. The second integer is the one-based index of the element in a MATLAB cell array or a MATLAB structure. For numeric and character arrays, the element index can be omitted or must be set to 0.

Permitted data structures are scalar value und data series. All integral data types are permitted.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

TransposeMatrix

Boolean value that specifies whether the rows and columns of the data matrix will be transposed.

Permitted data structures are scalar value. Supported data types are Boolean value.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value FALSE.

MatrixAsDataseries

Boolean value that specifies whether a data matrix with one column will be imported as a data series.

Permitted data structures are scalar value. Supported data types are Boolean value.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value TRUE.

Remarks

The import supports two-dimensional arrays only. In a MATLAB structure or in a cell array, only numeric or character arrays can be analyzed directly. Structures within structures are imported as lists. In this case, the List Element operator is needed to access to individual elements.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

ReadMATLABFile("c:\\examples\\file.mat", 1, FALSE, TRUE)

Imports the first field from a MATLAB file. The result is not transposed. If the field is a data matrix with a column, the result is returned as a data series.

Dim list = ReadMATLABFile("c:\\examples\\file.mat", {1, 6}, FALSE, TRUE)
list.["Segments"].["Data"].["Samples"]
 

Imports the sixth element of the first field from a MATLAB file. This field is a nested MATLAB structure. The result is a list whose elements also contain lists. Using the List Element operator, you can access the actual data found in the 'Samples' element.

See Also

File Import

List Element Operator

Share article or send as email:

You might be interested in these articles