WOLFRAM SYSTEM MODELER

print

Print string to terminal or file

Wolfram Language

In[1]:=
SystemModel["Modelica.Utilities.Streams.print"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

Streams.print(string);
Streams.print(string,fileName);

Description

Function print(..) opens automatically the given file, if it is not yet open. If the file does not exist, it is created. If the file does exist, the given string is appended to the file. If this is not desired, call "Files.remove(fileName)" before calling print ("remove(..)" is silent, if the file does not exist). The Modelica environment may close the file whenever appropriate. This can be enforced by calling Streams.close(fileName). After every call of "print(..)" a "new line" is printed automatically.

Example

Streams.print("x = " + String(x));
Streams.print("y = " + String(y));
Streams.print("x = " + String(y), "mytestfile.txt");

See also

Streams, Streams.error, ModelicaReference.Operators.'String()'

Syntax

print(string, fileName)

Inputs (2)

string

Default Value: ""

Type: String

Description: String to be printed

fileName

Default Value: ""

Type: String

Description: File where to print (empty string is the terminal)