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

8 ビュー (過去 30 日間)
Colton Harper
Colton Harper 2018 年 5 月 23 日
編集済み: Joe Myint 2023 年 5 月 31 日
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!

採用された回答

Joe Myint
Joe Myint 2018 年 5 月 23 日
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 件のコメント
Y.K.
Y.K. 2023 年 5 月 29 日
編集済み: Y.K. 2023 年 5 月 30 日
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.

サインインしてコメントする。

その他の回答 (1 件)

Joe Myint
Joe Myint 2023 年 5 月 30 日
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 件のコメント
Y.K.
Y.K. 2023 年 5 月 31 日
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 2023 年 5 月 31 日
編集済み: Joe Myint 2023 年 5 月 31 日
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

サインインしてコメントする。

コミュニティ

その他の回答  SimBiology コミュニティ

カテゴリ

Help Center および File ExchangeScan Parameter Ranges についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by