Comparing two MATLAB functions inside SIMULINK models

1 回表示 (過去 30 日間)
Deepayan Bhadra
Deepayan Bhadra 2021 年 2 月 25 日
回答済み: Infinite_king 2024 年 5 月 10 日
Hello, I am trying to compare 2 functions like below. When I use visdiff, it can't identify these functions as they are not stored separately in a directory, hence not on a folder path. Is there any alternative?
  1 件のコメント
Infinite_king
Infinite_king 2024 年 5 月 10 日
Can you obtain the source code of those MATLAB functions ?

サインインしてコメントする。

回答 (1 件)

Infinite_king
Infinite_king 2024 年 5 月 10 日
Hi Deepayan Bhadra,
  • If you have access to the source code of the functions, you can copy them and place them in any folder, then add that folder to the MATLAB path. After this, you can use the 'visdiff' function to visualize the differences in source code:
visdiff(filename1,filename2);
  • For more information on the visdiff function, refer the following MATLAB documentation - https://www.mathworks.com/help/matlab/ref/visdiff.html
  • If you don't have access to the source code, you can indirectly compare the functions by matching their outputs. To do this, provide a set of data inputs to both functions and compare their outputs. This can help identify any differences in behaviour.
  • If it helps, you can also compare entire Simulink models. For more information on comparing Simulink models, refer the following MATLAB documentation - https://www.mathworks.com/help/simulink/model-comparison.html
Hope this is helpful.

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by