Embedded Scripting¶
With embedded scripting, the power and diversity of Matlab is placed at your disposal within JCMsuite
’s input files.
The JCMsuite
input structure remains unchanged:
All .jcm
input files are still placed in a project directory.
As an extension it is allowed to declare placeholders (keys), and to embed Matlab code within the .jcm
files.
The so enriched input files have the extension .jcmt
or .jcmpt
(‘t’ stand for template)
to distinguish them from the plain .jcm
files.
When running the project with the solver wrapper jcmwave_solve.m, it is necessary to pass the parameter values for all used keys:
keys.radius = 0.3e-6;
keys.lambda_0 = 1.55e-6;
results = jcmwave_solve('project.jcmp', keys)
In this example it assumed that placeholders radius
and lambda_0
are used in the .jcmt
input files. The values to these parameters are passed as a Matlab structure , here called keys
. The computed data are returned in the cell array results
. The following section Tutorial is a step-by-step introduction which demonstrates the usage of embedded scripting within the .jcmt
files.