Legality of modifying built-in functions

조회 수: 1 (최근 30일)
Jakub Tomek
Jakub Tomek 2019년 11월 5일
댓글: Jakub Tomek 2019년 11월 5일
I'm not sure if I'm reading the licence agreement correctly, but is it so that it is not allowed to modify Matlab's built-in functions? At the same time, there are questions here with staff answers sounding like this is nothing that would not be allowed.
I would like to modify an ODE solver ode15s to allow the premature termination in case its runtime takes too long. I wouldn't distribute the code. Can I do this?
Many thanks.
  댓글 수: 2
Jakub Tomek
Jakub Tomek 2019년 11월 5일
Thank you, that's a neat use of events!

댓글을 달려면 로그인하십시오.

채택된 답변

Steven Lord
Steven Lord 2019년 11월 5일
For questions about the license agreement you should contact Customer Service using the telephone icon in the upper-right corner of this page.
For the technical question about the ODE solver, you don't need to modify ode15s to do what you want. Something like this should work:
  1. Write an events function that has a persistent variable inside it or that is nested inside another function.
  2. The first time the events function is called, it should store the current date and time (datetime('now')) in the persistent variable or a variable in the nested function's parent function.
  3. Each subsequent time the events function is called, it should check if enough time has elapsed since the saved date and time. If it has, the events function should report a terminal event to the ODE solver.
  4. Once the ODE solver has completed execution, clear the events function to clear the persistent variable.
Note that this won't stop the ODE solver immediately when your time limit is reached, but it will tell the ODE solver to stop as soon as possible.
  댓글 수: 1
Jakub Tomek
Jakub Tomek 2019년 11월 5일
Thank you, Steven for the reply and advice!
(For the record, I did try to contact the Customer Service using the telephone first, but was told that there was nobody available to talk to).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by