Backward compatibility of matlab.mixin.SampleTime class

2 ビュー (過去 30 日間)
Andre Franke
Andre Franke 2022 年 2 月 6 日
回答済み: Pratyush 2024 年 1 月 16 日
I am using matlab.mixin.SampleTime in various own developed Matlab System classes. Now with R2021b release matlab.mixin.SampleTime was moved to matlab.System classes. As a consequence one has to remove the matlab.mixin.SampleTime inheritence in all class definitions where it hast been used :-(. Even worse for me, I want to keep using my existing code with older Matlab versions. Can you propose any solution?

回答 (1 件)

Pratyush
Pratyush 2024 年 1 月 16 日
Hi Andre,
I understand that you want to maintain a single codebase that is compatible with multiple MATLAB versions.
To maintain compatibility with both the older versions of MATLAB and the R2021b (and later) releases, one approach is to conditionally inherit from matlab.mixin.SampleTime based on the MATLAB version at the time of execution. You can use MATLAB's "isMATLABReleaseOlderThan" function to determine the version and then dynamically inherit from the correct superclass. You can refer to this documentation for more details: https://in.mathworks.com/help/matlab/ref/ismatlabreleaseolderthan.html

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by