MATLAB: How to convert .sbproj files to matlab code

SimBiology

I am developing a model with GUI interface. Is there a way of seeing the matlab code of the model that I am developing in GUI.

Best Answer

Hi Kannan,
I'm not sure what you mean by "seeing the MATLAB code of the model." Here are some things that might be related to what you want to do:
Option 1: MATLAB Code Capture in the SimBiology Desktop
When you build a model in the SimBiology Desktop, you can view the equivalent MATLAB Code for building the model using the MATLAB Code Capture Tool. You can open that tool as follows:
  • Open the SimBiology Desktop.
  • Click on Layout button, in the Home toolstrip.
  • Select the MATLAB Code Capture Tool from the Layout menu.
Now, as you build your model, you will see MATLAB code appearing in this tool.
Option 2: Viewing the ODE equations for a model
Another thing you might be interested in is view the ordinary differential equations (ODEs) for a model. You can do this from either the command-line or from the SimBiology desktop. From the command-line, you can view the equations for the variable model by typing getequations(model). From the desktop, do the following:
  • Open the SimBiology Desktop.
  • Open the .sbproj file.
  • Double-click on the model you're interested in.
  • Click on the Open button in the Model toolstrip.
  • Select Equations from the Open menu.
Option 3: Incorporating a SimBiology model into a GUI
Perhaps you don't really need to view MATLAB Code. Maybe you just want to know how to incorporate a SimBiology model into a GUI. If you want the GUI to work with the MATLAB Compiler, so that you can deploy this GUI as a standalone application, then you may want to look at this demo.
As of R2015b, the SimBiology Desktop also makes it easy to create a GUI for a SimBiology model. I'm copying the following information from the SimBiology Release Notes:
Application builder for model distribution and simulation
You can create standalone applications for model distribution and simulation from the SimBiology desktop. The application can be an executable that runs outside of MATLAB® or a MATLAB app. To deploy a standalone application, you need MATLAB Compiler™.
To build an executable for model simulation, first add a simulation task and open it. Then in the Task Editor, on the Editor tab, select Create App > Deploy. For a MATLAB app, select Create App > Package as MATLAB App.
You can include model exploration tools in the application, such as sliders to adjust quantity values and dose schedules, as well as calculated statistics. To test the user interface and see the final deployed application or MATLAB app, select Create App > Launch.
Hopefully, one of these options addresses your question. If not, I recommend posting a new question that is more specific.
Good luck!
-Arthur