The following example uses a supplied MATLAB script (SimpleMidpoint.m), which is installed with Nexus 2 in the following default folder:
C:\Program Files (x86)\Vicon\Nexus2.#\SDK\Win64\Matlab\Examples
This example script creates a marker mid way between two existing markers in a loaded trial, so you must specify the subject, the two markers between which to create the midpoint, and the name of the midpoint marker that is to be created.
To execute a MATLAB script from within Vicon Nexus:
- In Nexus, open the trial on which the script is to run.
- In the Communications window, click on the Matlab tab.
- In the Matlab script field, enter or browse to the folder that contains the required MATLAB script (*.m).
- In the Input arguments field, if your script requires arguments, provide a comma-separated list of arguments to be used by the script, surrounding each argument with single quotes. In this example:
The supplied examples show the required input and its format.
If your script does not require any arguments, leave the Script arguments field blank.
- If you want to launch MATLAB and display your script, click the Launch Matlab button.
- Click Run Script.
Information, such as a time stamp and text describing the processing, together with any error messages, is displayed on the Matlab tab. Relevant information is also displayed in the Log pane.
The modeled marker (in this case, the midpoint marker, LWRM) is created, and can be seen in the 3D Perspective view.
On the Subjects Resources pane, additional outputs are displayed under a newly created Modeled Markers node of the resources tree. In the following example, the new marker is called MyMidpoint.
- Display a Graph view of the new marker to see that a trajectory for the new marker has been created for the whole trial.
- If necessary, you can change your script in MATLAB and, to check that it has the desired result, run it again from either MATLAB or by clicking Run Script again.
- When you have finished refining your script, to include it in a pipeline, click Create Pipeline, which copies the information you have supplied to a Data Processing pipeline operation, Run Matlab Operation in the Pipeline tools pane. The required inputs are displayed in the Properties pane.