result = readReal_m(fileName, name);
This function demonstrates how a function can be implemented that reads the value of a parameter from a Matlab script-file. The idea is to keep parameters in Modelica and in Matlab/Simulink up to date. The function performs the following actions:
function readReal_m extends Modelica.Icons.Function; import Modelica.Utilities.*; input String fileName "Name of file" annotation( Dialog(loadSelector(filter = "m-file (*.m)", caption = "Open m-file for reading"))); input String name "Name of parameter"; input Boolean cache = false "Read file before compiling, if true"; output Real result "Actual value of parameter on file"; end readReal_m;