Can I create a variant that captures all current parameter, species and compartment values?

1 view (last 30 days)
So I'd like to be able to do something like this:
sbr = sbioroot; % Get the root object
lastn = length(sbr.models); % Get index of the last model object (presumably the one I'm using)
ml = sbr.models(lastn); % Get a handle for the model in use;
varobj = sbiovariant('Current'); % add a variant to that model
varobj = addcontent(varobj,allcurrentcontent(m1));
or perhaps instead of "all current content" I could use more granular commands, as in the desktop. In interactive mode, I can "add all species", "add all compartments" and "add all parameters" to a variant.
So perhaps
varobj = addcontent(varobj,m1.species);
varobj = addcontent(varobj,m1.parameters);
varobj = addcontent(varobj,m1.compartments);
Ideally, the sbiovariant command would allow a flag. All, Species, Compartments, and Parameters. So
varobj = sbiovariant('Current','All'); % adds a variant containing all numbers to the current model
Or is there already something like this that I'm missing?
Thanks!

Accepted Answer

Arthur Goldsipe
Arthur Goldsipe on 1 Oct 2018
You're not overlooking anything. We just need to make variants easier to use. Right now, I would probably do this by making a helper function with a "for loop" to add each item to the variant.
Also, one note. There are two ways to make a variant in SimBiology. When you call "sbiovariant" you are making a "standalone" variant. You can also call "addvariant" to create a variant that is stored on your model. One reason to make a standalone variant is if you want to use it with multiple related models.
  1 Comment
Jim Bosley
Jim Bosley on 2 Oct 2018
Thanks, Arthur. Appreciate the explanation of add_ vs sbio-variant.
As I understand it, one could (for example) take the model object, extract m1par = m1.parameters, and then loop through the list by adding m1par(i) to the variant. Makes sense.
Agree - variants have power now, and could be even more powerful. I'd really like to be able to turn rules on and off using variants.

Sign in to comment.

More Answers (0)

Categories

Find more on Extend Modeling Environment in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!