MATLAB Answers

0

Not finding info on arrays of variant objects

Asked by Jim Bosley on 4 Sep 2018
Latest activity Edited by Jim Bosley on 5 Sep 2018
The help page on variant objects advises that the "active" property of variants is being deprecated: "The Active property of the Variant object will be removed in a future release. Explicitly specify a variant or an array of variants as an input argument when you simulate a model using sbiosimulate". I think multiple, layered variants is a good idea. But nowhere in the documentation can I find an example of a variant array. Is there a scripted example? Specifically, is there an example of a sbiosimulate using an array of variants?
Or, could somebody share a snippet of code that shows how a couple of variants can be used? As simple as {var1, var2} or [var1 var2] in the variant object space in sbiosimulate? These didn't seem to work for me.
How do you construct an array of variants specified in the documentation above. Must one create a new variant, or can I specify a list somehow?
Thanks!

  0 Comments

Sign in to comment.

Products


Release

R2018a

1 Answer

Answer by Arthur Goldsipe on 4 Sep 2018

Hi Jim,
Sorry this wasn't clear from the documentation. I think [var1 var2] should have worked. Here are some equivalent ways to simulate a model using the 1st and 3rd variant on a model:
allVariants = getvariant(model);
variant1 = allVariants(1);
variant3 = allVariants(3);
variants1and3 = [variant1 variant3];
sd1 = sbiosimulate(model, variants1and3);
sd2 = sbiosimulate(model, [variant1 variant3]);
sd3 = sbiosimulate(model, allVariants([1 3]));
If you're still having problems, can you share some code on how to reproduce whatever error you're getting? Once we figure out where the confusion is, I'll work with our writer to try to clear things up in the documentation.
-Arthur

  1 Comment

"There are more [simbiology commands] in heaven and earth, [Arthur], Than are dreamt of in [my] philosophy". Apologies to Willie.
Thanks for this. It answers my questions, provides excellent examples, and points out the dedicated commands so I learned something. I am guessing that
allVariants = getvariant(model);
gives the same results as
allVariants = sbioselect(m1,'Type','Variant');
It also points out that its very important to understand the argument list. The previous command, without 'm1' returns all variants in the entire sbioroot object!
I also note that one can either use numerical indices or
var_I_want = sbioselect(allVariants,'Name','Name_of_wanted_variant');
Your note also gives code examples of variant arrays. I was able to find dose array examples after I posted the question, but this is very useful - and now available for all.
I should say that I couldn't get the [var1 var2] array to work in my model because I was working with two model versions and one version didn't have var2. Sooo.... Pilot error, or rather, confusion. Thanks, Arthur.

Sign in to comment.