![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1364883/image.png)
Can't remove a custom-made kinetic law using sbioremovefromlibrary
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
SimBio_User
am 24 Apr. 2023
Beantwortet: Jeremy Huard
am 24 Apr. 2023
I am using MATLAB R2022b in case it is relevant.
I am trying to remove a kinetic law that I have added in my user-defined library. I have called it "Uni-Uni MM reversible with e0". I use sbioremovefromlibrary function for such a purpose. However, I only get the following as output:
Warning: Kinetic law named 'Uni-Uni MM reversible with e0' is being used by reaction kinetic
law(s), and cannot be deleted. Type the following command to find kinetic laws using it.
klusedby = sbioselect('Type','kineticlaw','KineticLawName','Uni-Uni MM reversible with e0')
How do I proceed from here? I would also want to change the rate expression instead of removing it from the library. However, I don't know if that is possible
0 Kommentare
Akzeptierte Antwort
Jeremy Huard
am 24 Apr. 2023
Hi,
the easiest way to manage the user-defined library might be from within the Model Builder app:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1364883/image.png)
That said, you can still modify a user-defined kinetic law programmatically with:
kl = sbioselect(sbioroot, Name='Uni-Uni MM reversible with e0',Type='abstract_kinetic_law');
kl.Expression = '<edit the expression here>'
If you want to remove an existing user-defined kinetic law programmatically that is already used in a model, you can do the following:
kl = sbioselect(sbioroot, Name='mylaw1',Type='abstract_kinetic_law');
% find reactions in model that use this kinetic law
reacObj = findUsages(kl, modelObj);
% set the kinetic law of these reaction to 'Unknown' but keeping the same reaction rates
% by reassigning the Reaction Rate to itself
arrayfun(@(x) set(x,'ReactionRate',x.Reaction.Rate), reacObj);
% remove kinetic law from library
sbioremovefromlibrary(kl)
Best regards,
Jérémy
0 Kommentare
Weitere Antworten (0)
Communitys
Weitere Antworten in SimBiology Community
Siehe auch
Kategorien
Mehr zu Extend Modeling Environment finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!