How do I convert a .m script to .sbproj file?

7 visualizaciones (últimos 30 días)
Colton Harper
Colton Harper el 23 de Mayo de 2018
Editada: Joe Myint el 31 de Mayo de 2023
I have both Simbiology and MATLAB installed on my machine. I have implemented a SimBiology model using MATLAB code, which is saved as a .m file. I would like to save or convert this model to a .sbproj file. Is there a way to achieve this?
I am trying to do this because we simulate our model using a MATLAB script. This script defines all of the modeling parameters, including an SSA solver and triggering events. Our previous model was implemented using the SimBiology Graphical User Interface. We have made a similar model using SimBiology Command Line. The model we created is somewhat similar to what is shown here: https://www.mathworks.com/help/simbio/gs/-model-a-gene-regulation-pathway.html. We want to simulate the new model that was created from the SimBiology Command Line using our simulation script. However, this requires the SimBiology model to be saved in .sbproj format. Any ideas on how this could be achieved would be much appreciated.
Thank you!

Respuesta aceptada

Joe Myint
Joe Myint el 23 de Mayo de 2018
Hi Colton,
You can use the sbiosaveproject function to save the SimBiology model (and data) to a .sbproj file. For example,
model = sbmlimport ('oscillator.xml');
simData = sbiosimulate(model);
sbiosaveproject oscillator.sbproj model simData;
Hope it helps, Joe
  1 comentario
Y.K.
Y.K. el 29 de Mayo de 2023
Editada: Y.K. el 30 de Mayo de 2023
Hi, Joe
I could not see the saved 'simData' in the 'oscillator.sbproj' which had been generated and saved using your sample code.
What was wrong with the procedure?
The 'oscillator.sbproj' file was created from the command window of Matlab 2019b.
I checked the 'simData' using the GUI of Simbiology Model Analyser for Matlab 2019b.

Iniciar sesión para comentar.

Más respuestas (1)

Joe Myint
Joe Myint el 30 de Mayo de 2023
Hi Y.K.,
Opening the SBPROJ directly in the SimBiology Model Analyzer app will not automatically load the simData that was saved previously at the command line. To import the simData, you need to do these additional steps:
  1. At the command line, enter: sbioloadproject("oscillator.sbproj"). You should get model and simData loaded in the workspace as variables.
  2. Enter: simBiologyModelAnalyzer("oscillator.sbproj"). The app opens and "model" is loaded in the app.
  3. On the Home tab of the app, select Data > Import Data from MATLAB workspace. Select simData. Click OK. simData is now loaded in the app in a separate folder, such as Data1.
Hope it helps,
Joe
  2 comentarios
Y.K.
Y.K. el 31 de Mayo de 2023
Dear Joe,
I could see the simulated data as you have written.
I also want to ask one more question.
I want to load the simulated data and save the project using a script.
I thought step1. and step 2. could be coded. (Am I right?)
Are there any way to do step3 and saving the project by a code?
Many thanks before your reply.
Kind Regards,
Y.K.
Joe Myint
Joe Myint el 31 de Mayo de 2023
Editada: Joe Myint el 31 de Mayo de 2023
Hi,
I am not so sure what you are trying to do. You can use sbiosaveproject and add the model and simulation data to the project using:
sbiosaveproject oscillator.sbproj model simData;
However, it sounds like you are trying to ask if there is a command line way to imitate the tasks that you would normally do in the app? If so, there is no command line function to do the task described in step 3. Step 1 and step 2 are already the command line function/way.
Having said that, you can generate code for modeling-specific actions and analysis programs from the apps. Take a look at these examples to see if they might be helpful.
HTH,
Joe

Iniciar sesión para comentar.

Comunidades de usuarios

Más respuestas en  SimBiology Community

Categorías

Más información sobre Scan Parameter Ranges en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by