The CLI package of Massif allows the converting between the Simulink models and Massif EMF models inside of MATLAB scripts.
Setup
Download the package from:
You have to download it and add its path to the MATLAB’s java path via the javaaddpath(/jar’s location as a string goes here/)
command.
Create MATLAB model from Massif EMF model
First you have to create a modelImporter
object which is an instance of the CLIMatlabCreator class:
modelImporter = hu.bme.mit.massif.simulink.cli.CLIMatlabCreator;
With this you can create the MATLAB model via calling CLIMatlabCreator’s createMatlabModel()
method like this:
modelImporter.createMatlabModel([modelName], [modelPath], [extension - optional]);
-
The
modelName
is the name of the model file without extension as a string. -
The
modelPath
is the folder path containing the model file as a string. -
The (optional)
extension
is the file extension in which the created model file will be saved. Its default is"slx"
.
Create Massif EMF model from MATLAB model
First you have to create a modelExporter
object which is an instance of the CLIEMFCreator class:
modelExporter = hu.bme.mit.massif.simulink.cli.CLIEMFCreator;
With this you can create the Massif EMF model via calling CLIEMFCreator’s createSimulinkModel()
method like this:
modelExporter.createSimulinkModel([modelName], [outputDir], [importMode - optional]);
-
The
modelName
is the name of the model file without extension as a string. -
The
outputDir
is the folder path in which the generated Massif EMF model will be saved. -
The (optional)
importMode
is an enum to select the import mode. It can have the following four values:-
hu.bme.mit.massif.simulink.api.util.ImportMode.SHALLOW
-
hu.bme.mit.massif.simulink.api.util.ImportMode.DEEP
-
hu.bme.mit.massif.simulink.api.util.ImportMode.FLATTENING
-
hu.bme.mit.massif.simulink.api.util.ImportMode.REFERENCING
The meaning of the import modes is described here.
-