MATLAB Interface Programming Young Joon Kim http://www.helloapps.com
Topics MATLAB Command in SPL Execute MATLAB in SPL Execute Simulink model file Get Variable from MATLAB Get String from MATLAB Put string to MATLAB Put and Get Full Matrix Put and Get Workspace Data
MATLAB Command in SPL
MATLAB Command in SPL MATLAB Command under “Expression” tab
Execute MATLAB in SPL
Execute MATLAB in SPL Add “MATLAB” command as follows Double click
Execute MATLAB in SPL Add “matlab1.Execute()” command as follows
Execute MATLAB in SPL Type “print” command as follows
Execute MATLAB in SPL Save and execute script
Prepare Simulink
Prepare Simulink Draw below diagram with Simulink
Prepare Simulink Executed result
Prepare Simulink Save diagram as “satellite.mdl”
Execute Simulink model file
Execute Simulink model file Type command [t,x,y] = sim(‘satellite.mdl’) Util.UserDataDir returns MSRDS’s UserData path
Execute Simulink model file Execute script and print
Execute Simulink model file Save and execute SPL script
Get Variable from MATLAB
Get Variable from MATLAB Execute command
Get Variable from MATLAB Use “matlab1.GetVariable()” command to get variable
Get Variable from MATLAB Check the upper bound of returned array Dimension 1 and dimension 2
Get Variable from MATLAB Print the value of variable
Get Variable from MATLAB Save and execute script
Get String from MATLAB
Get String from MATLAB Define string value in the MATLAB
Get String from MATLAB Use “GetCharArray()” method to get string from MATLAB
Get String from MATLAB Save and execute script
Put String to MATLAB
Put string to MATLAB Use “PutCharArray()” command to send string to MATLAB
Put string to MATLAB Save and execute SPL script
Put and Get Full Matrix
Put and Get Full Matrix Define array and initialize
Put and Get Full Matrix Use “PutFullMatrix()” to send array data to MATLAB
Put and Get Full Matrix Send command to make matrix “b”
Put and Get Full Matrix Use “GetFullMatrix()” command to get matrix data from MATLAB
Put and Get Full Matrix Full script
Put and Get Full Matrix Save and execute SPL script
Put and Get Workspace Data
Put and Get Workspace Data Use “PutWorkspaceData” to send data to MATLAB
Put and Get Workspace Data Send command to define matrix “b” as follows
Put and Get Workspace Data Use “GetWorkspaceData” command to get data
Put and Get Workspace Data Save and execute SPL Script