How do I convert a .m script to .sbproj file?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Colton Harper
le 23 Mai 2018
Modifié(e) : Joe Myint
le 31 Mai 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!
0 commentaires
Réponse acceptée
Joe Myint
le 23 Mai 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 commentaire
Y.K.
le 29 Mai 2023
Modifié(e) : Y.K.
le 30 Mai 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.
Plus de réponses (1)
Joe Myint
le 30 Mai 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:
- At the command line, enter: sbioloadproject("oscillator.sbproj"). You should get model and simData loaded in the workspace as variables.
- Enter: simBiologyModelAnalyzer("oscillator.sbproj"). The app opens and "model" is loaded in the app.
- 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 commentaires
Y.K.
le 31 Mai 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
le 31 Mai 2023
Modifié(e) : Joe Myint
le 31 Mai 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.
View and Run Program Code Generated by SimBiology Model Analyzer - MATLAB & Simulink (mathworks.com)
HTH,
Joe
Communautés
Plus de réponses dans SimBiology Community
Voir également
Catégories
En savoir plus sur Scan Parameter Ranges dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!