I need to create a series of SimBiology models with similar attributes, so I am creating a new model equal to my original model so that I can make some small tweaks to the new object, using a MATLAB script. I'll call the original model model and the new model model2:
model2 = model;
Now suppose I want to simply change the name of one of the species in model2, say, from E to E1:
model2.species(1).Name = [model2.species(1).Name num2str(1)];
And certainly species 1 of model 2 has a 1 appended on to the end of its name. My problem is that my code makes this change for my original model as well, even though I have made no mention of it in my code. So if I call 'model.Species' and 'model2.Species', I obtain exactly the same result:
Index: Compartment: Name: InitialAmount:1 unnamed E1 0
Can anyone provide any issue into this issue; specifically, how do I prevent the original model's attributes from changing when I change model2's? It seems that model2 is somehow both a SimBiology object and a pointer to model??