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 件のコメント
Daniel M
Daniel M 2019 年 11 月 5 日
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 Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by