How to show link to block in custom error Diagnostic Viewer

3 ビュー (過去 30 日間)
Daniel Lemus
Daniel Lemus 2020 年 7 月 22 日
コメント済み: Tobias Huth 2022 年 11 月 22 日
Hi
I would like to include a link in the message displayed in the Diagnostic viewer such that the user can click on it and redirected to the block that has the issue.
My code
message = sprintf('The input signal %s does not coincide with the module %s\n',inNames{i},bObj.Name);
my_stage = sldiagviewer.createStage('Signal mismatch','ModelName','vdp');
sldiagviewer.reportError(message); % How to inlcude link to block bObj.Name?

採用された回答

Chaitanya Mallela
Chaitanya Mallela 2020 年 8 月 20 日
編集済み: Chaitanya Mallela 2020 年 8 月 20 日
The command to display the link to the current block in the Diagnostic Viewer is as shown
sldiagviewer.reportError(sprintf('<a href = "matlab:hilite_system(''%s'')">Block Name</a>\n',gcb));
This command displays the message link Block Name in the Diagnostic Viewer which redirects to the current block in the model. To link to any block in the model replace gcb with block path name and display name can also be customized.
  1 件のコメント
Tobias Huth
Tobias Huth 2022 年 11 月 22 日
thank you for providing the solution using sprintf!
I used disp, on a referenced subsystem's block and this does not work.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConfigure and View Diagnostics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by