Difference between revisions of "HANtune/MATLAB Interface"
From OpenMBD
< HANtune
(→Reading data from a running Simulink model) |
(→Reading data from a running Simulink model) |
||
Line 11: | Line 11: | ||
<nowiki>#Change these to the name and location of your model | <nowiki>#Change these to the name and location of your model | ||
modelName = 'MyModel' | modelName = 'MyModel' | ||
− | modelPath = 'C:\Users\Michiel Klifman\Desktop' | + | modelPath = 'C:\Users\Michiel Klifman\Desktop'</nowiki> |
#Add folders to MATLAB path | #Add folders to MATLAB path | ||
Line 17: | Line 17: | ||
scriptPath = System.getProperty("user.dir") + "\scripts\examples\MATLAB_Interface" | scriptPath = System.getProperty("user.dir") + "\scripts\examples\MATLAB_Interface" | ||
engine.eval("addpath('" + scriptPath + "')") | engine.eval("addpath('" + scriptPath + "')") | ||
− | engine.eval("addpath('" + modelPath + "')") | + | engine.eval("addpath('" + modelPath + "')") |
===Creating a daq list=== | ===Creating a daq list=== | ||
==Reading data from a running Simulink model== | ==Reading data from a running Simulink model== |
Revision as of 18:54, 21 October 2019
HANtune can be interfaced with MATLAB® (and by extension Simulink®). We can do this by using the MATLAB engine and calling it from a script.
Note: You will need to have installed a version of MATLAB® with the Java MATLAB engine.
Contents
Connecting to the MATLAB Engine
Reading data from a running Simulink model
Set your model
#Change these to the name and location of your model modelName = 'MyModel' modelPath = 'C:\Users\Michiel Klifman\Desktop'
- Add folders to MATLAB path
from java.lang import System scriptPath = System.getProperty("user.dir") + "\scripts\examples\MATLAB_Interface" engine.eval("addpath('" + scriptPath + "')") engine.eval("addpath('" + modelPath + "')")