Can't remove a custom-made kinetic law using sbioremovefromlibrary

조회 수: 1 (최근 30일)
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

채택된 답변

Jeremy Huard
Jeremy Huard 2023년 4월 24일
Hi,
the easiest way to manage the user-defined library might be from within the Model Builder app:
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개)

커뮤니티

더 많은 답변 보기:  SimBiology Community

카테고리

Help CenterFile Exchange에서 Extend Modeling Environment에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by