MATLAB: How to output concentrations if species dimension is ‘substance’.

concentrationdefaultspeciesdimensionMATLABSimBiologysimulate modelsubstance

I have a huge model where 'DefaultSpeciesDimension' is set to 'substance'. I coded in terms of substance amounts, because it was easier that way. If I want to output concentrations when I simulate the model, will I have to define concentrations (with rules), or is there some easy way to switch plots to concentrations using the user interface?

Best Answer

Hi Colin,
Today (as of R2016b), you must decide to represent a species either in amount or in concentration. There is no direct way to refer to both the amount and concentration of a species in the same model.
As you've already discovered, one workaround would be to add a repeated assignment rule to calculate the concentration.
I can think of another possible workaround within the SimBiology Desktop. If you want the concentrations to appear on the "Live Plots" within a simulation task, then you can add a calculated value to a plot. You can read more about in the documentation (search for Define Math). To summarize that, you'd need to add a plot entry for the species amount, another for the compartment volume, and then add math along the lines of SpeciesAmount./CompartmentVolume, where SpeciesAmount is the legend name for the species amount and CompartmentVolume is the legend name for the compartment.
Feel free to contact me directly if you have additional questions, since I don't get notified of any additional comments you post here.
-Arthur