impure functionwriteRealMatrix
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
success = Streams.writeRealMatrix(fileName, matrixName, matrix, append, format)
Description
Function writeRealMatrix(..) writes the given matrix to a new or an existing MATLAB MAT file
(in format v4, v6, v7, and if HDF is supported in the Modelica tool, also v7.3).
If append = false (= default), the file is newly created
(or an existing file is deleted and re-created).
If append = true, the matrix is included in an existing file or if the
file does not yet exists this flag is ignored. If the file exists and
append = true, argument format is ignored.
Parameter format defines the format in which the values are stored on file.
The following formats are supported:
| format = | Type of format |
| "4" | MATLAB MAT version v4 |
| "6" | MATLAB MAT version v6 |
| "7" | MATLAB MAT version v7 |
| "7.3" | MATLAB MAT version v7.3 (requires HDF support in the Modelica tool) |
The function returns success = true if the matrix was successfully written
to file. Otherwise, an error message is printed and the function returns with
success = false.
Example
See Examples.WriteRealMatrixToFile.
See also
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | fileName | File where external data is to be stored | |
| String | matrixName | Name / identifier of the 2D Real array on the file | |
| Real[:,:] | matrix | 2D Real array | |
| Boolean | append | false | Append values to file |
| String | format | "4" | MATLAB MAT file version: "4" -> v4, "6" -> v6, "7" -> v7 |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | success | true if successful |