Better understanding of variants sought (also project files)

1 visualización (últimos 30 días)
Jim Bosley
Jim Bosley el 4 de Sept. de 2018
Editada: Jim Bosley el 5 de Sept. de 2018
If I create a model using the dashboard, including variants(suppose 2, 'var1', and 'var2'), and save the model, the variants are saved with the model. If I close the model, then open it with
sbioreset;
Simbiology('MyModel');
then the model is not listed in the workspace. But I can use the dashboard to see the model (including variants). I can load the model object into the workspace to allow manipulation using scripting:
sbr = sbioroot;
m1 = sbr.models(1)
Because I left the semicolon off, I see something like:
SimBiology Model - MyModel
Model Components:
Compartments: 7
Events: 0
Parameters: 181
Reactions: 83
Rules: 42
Species: 40
Note that there are no variants listed! But if I use
vars = sbioselect('Type','Variant');
I get
SimBiology Variant Array
Index: Name: Active:
1 var1 false
2 var2 false
So the variants are there, but are not listed with the model. The variants aren't listed using sbiowhos, either. Why aren't the variants listed? Is there a command (besides using sbioselect for each type of object) that lists all components of a model?
My understanding of the difference between sbioloadproject('modelname') and simbiology('modelname') is confused. As I understood it, the Simbiology() command opens a model, including variants and all other properties. It has to, because it opens the full model in the dashboard. But my understanding is that the sbioloadproject() command does NOT load variants, tasks, datasets, and graphical location information (that is, the stuff that tells the dashboard how to arrange species and reactions on the diagram view). Is there someplace tells me how to find ALL of the components of a model object? It might help to know all of what goes into a sbproj file, and (assuming that simbiology() loads all model elements) what are the elements that sbioloadoproject does NOT load. Clearly I was wrong, and variants are loaded.
And I would think that typing 'm1' (where m1 is a model object in the workspace) should list everything associated with that object including variants and datasets and (in the case of loading with Simbiology()) the set of object locations.

Respuestas (1)

Arthur Goldsipe
Arthur Goldsipe el 4 de Sept. de 2018
Hi Jim,
Variants (and doses) are handled differently than the objects you see listed in the display for a model. As you discovered, one way to get access to them is via sbioselect. The primary way that we intended users to get access to them is via the methods getvariant and getdose. And you'll find a list of all methods and properties for a model on this reference page.
-Arthur
  3 comentarios
Arthur Goldsipe
Arthur Goldsipe el 5 de Sept. de 2018
As you've discovered, there is currently an undocumented Variants property on SimBiology models. If you look at the public, visible properties in the documentation or programmatically, you will not find this property listed. (I'll describe how to programmatically list public, visible properties in a minute.) Therefore, I generally recommend using the getvariant method rather than the Variants property, since undocumented behavior could change at any time.
There are several ways to programmatically get a list of all public, visible properties. The function properties does not currently work due to an incompatibility that we hope to address in the near future. Until then, fieldnames is a more general function that works on MATLAB objects, Java objects, and structs. Finally, you can also use the set and get methods to find out information about the properties on a SimBiology object. get(obj) will return a struct that contains all the public, visible properties that you can get. set(obj) will return a struct that contains all the public, visible properties that you can directly set. Oh, and you can also rely on tab-completion to get property names, so obj.<TAB> should bring up a list of all methods and properties.
Regarding your list of things that a useful environment must provide: We strive for all of these things to be described clearly in our documentation. Not all of that information can be accessed programmatically today, but there are lots of MATLAB features to make it more and more available. The SimBiology team will hopefully take advantage of those features soon, so that it is easier for you to figure out interactively how to use SimBiology.
Jim Bosley
Jim Bosley el 5 de Sept. de 2018
Editada: Jim Bosley el 5 de Sept. de 2018
Arthur,
The fieldnames() function is something that I was looking for - VERY useful. And this satisfies a lot of the need wrt to my "list".
I think it's awfully hard for experts/creators of software to write documentation. First, mostly we hate doing it (at least I do). Second, when one has created something, we have implicit knowledge of what objects are and what they do, and sometimes this implicit stuff is hard to write out and isn't included in the docs.
fieldnames() will be used extensively. While I'll pat myself on the back finding modelname.Variant, I'll also try to stick to the prescribed "getvariant" command.
Suffice to say that I'm enjoying using SimBiology and feel that I'm productive at this point and learning to be more so. This level of satisfaction and progress would NOT be happening without help from you and your colleague's. So, thanks again.

Iniciar sesión para comentar.

Categorías

Más información sobre Scan Parameter Ranges en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by