It is often useful to share data between projects or users.
Lumerical scripting allows to import and export data.
In this unit, we will focus on data in text format file.
The write command will write the content of a string variable to the specified file.
If the file doesn't exist, it will be created.
If it does exist, the string will be appended to the end of the file.
If you want to write numerical values to a text file, you will have first to convert
these values to strings using the num2str command.
By default, the script interpreter will use a maximum of 6 digits of precision.
You can use the format command to toggle the precision state between short (the default)
and long (16 digits of precision).
The readdata command will import numerical data stored in a text file in a row/column
You must ensure the data is correctly formatted so each row has the same number of column.
The output of this command will be a matrix.
Note that any line that begins with a letter will be ignored.
In the next unit, we will see how to import and export data in binary files.