How to plot the values of a variable used in a DPL script?
Category:
Scripting
Answer
To plot the values of a variable used in a DPL script, you must first save the values of the variable in a result file (ElmRes).
For this, define result parameters on the "Result" page of your script object and add these as recording variables to your result file (here: "res"):
res.AddVars(this, 'b:y');
res.AddVars(this, 'b:x');
res.Init();
The variables can then be calculated and stored in the result file:
for(this:x = 0; this:x <= 10; this:x += 0.5) {
this:y = 0.5*this:x;
res.Write();
}
Once the result file "res" has been filled, it can be used for plotting.
The attached file contains a small project with a sample script in which some values are calculated and plots are created with values from the results file. In the first plot, "y" is displayed above the index of the result file, while in the second plot "y" is displayed above "x".