App to convert Simbiology models to .sbproj files

2 次查看(过去 30 天)
Hi, I frequently need to convert Simbiology models to .sbproj files using simple script with 'sbiosaveproject' function. I am inerested to build .exe out of this script using Matlab Compiler. However I am not sure if sbiosaveproject is supported by the Compiler. https://www.mathworks.com/products/compiler/supported/compiler_support.html Is there a way to do it?

采纳的回答

Arthur Goldsipe
Arthur Goldsipe 2017-11-22
Hi Ivan,
The key questions are (1) why do you want to create an EXE app, and (2) what do you really need to accomplish with the app?
If your goal is to create .sbproj files without a full license and installation of MATLAB and SimBiology, that is not currently possible due to licensing restrictions. The compiler support page lists the restrictions on apps created with MATLAB Compiler. For SimBiology apps, we do not support .sbproj files or the models stored in such files. Instead, you must use SimBiology.export.Model objects or SimFunction objects, which must be saved in .mat files. Both of these provide the ability to simulate a model. However, you cannot build new models or change the structure of such models. (What I mean by that is you can't add or remove things like species or reactions in an app.)
If your goal is to use SimBiology functionality in an environment that does not require a license of MATLAB or SimBiology, you must write an app that uses SimBiology.export.Model objects or SimFunction objects. Here's an example .
If you goal is to automate the creation of sbproj files, you have several options for doing that, but all the options would require full license and installation of both MATLAB and SimBiology. Then, you could create an app using the App Designer. You could also create an .exe that communicates with the installation of MATLAB to run your script that create .sbproj files. You can see a list of APIs for various languages in the documentation for MATLAB Engine Applications.
Does that clear things up?

更多回答(5 个)

Sietse Braakman
Sietse Braakman 2017-11-17
Hi Ivan,
I am not sure I fully understand your situation. If your SimBiology models are not already an .sbproj, what format are the models in before you save them to .sbproj? With the .exe, is your aim to open a model and save it to .sbproj?
Kind regards,
Sietse

Ivan Borisov
Ivan Borisov 2017-11-17
Hi Sietse, the models are generated from code (.m file). The script (or function) I would like to turn into .exe is smth like run(<codefile>.m); sbiosaveproject sbproj_file;
Ivan

Sietse Braakman
Sietse Braakman 2017-11-17
编辑:Sietse Braakman 2017-11-17
Hi Ivan,
Here are my thoughts:
  • If your models are "SimBiology.Model"-objects (you can hoover over the model in your workspace to confirm), you can do the following:
  1. Create an app (if you are on MATLAB 2017b, I would recommend using the App designer, rather than GUIDE). In the app:
  2. Create a button to load the script (uigetfile),
  3. once loaded, evaluate the script (eval),
  4. create a text input box to define the file name you want to use for the project,
  5. create another button that, when clicked, runs code to save the model (sbiosaveproject with the file name defined in step 4).
  6. compile the app to give you a .exe
  • If your models are MATLAB models (i.e. sets of ODEs in MATLAB, rather than a SimBiology.Model object), you could write a script that parses out your ODEs to create a SimBiology model. For instance, you could generate a species for each state in your model and assign a rate rule to each species that is defined by the right-hand side of your ODE. Once you have created this SimBiology model, you'll have a SimBiology.Model object, which you can proceed with as above.
I hope that helps. Kind regards,
Sietse

Ivan Borisov
Ivan Borisov 2017-11-21
Hi Sietse, Thanks for clarification!
Unfortunately I have the following issue:
'D:/MATLAB/R2017a/toolbox/simbio/simbio/sbiosaveproject.m MATLAB:depfun:req:ExcludedBy The file or function has been excluded from packaging for the "MCR" target environment'
Is there a workaround?

Ivan Borisov
Ivan Borisov 2017-11-23
Hi Arthur! Thanks for clarification. My goal is to convert models created as .m files to .sbproj in an environment where Matlab is not installed. I see that Compiler doesn't support such convertation.

社区

更多回答在  SimBiology Community

类别

Help CenterFile Exchange 中查找有关 Perform Sensitivity Analysis 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by