フィルターのクリア

issuing a warning with details

20 ビュー (過去 30 日間)
nathan blanc
nathan blanc 2020 年 11 月 10 日
編集済み: Adam Danz 2020 年 11 月 10 日
I want matlab to issue a warning, with a lot of details. However, i don't want to flood the command propmt. i thought of issuing the warning and then adding an (ofline) link to the relevant documentation. I mean that the user can click on the command prompt and then get to the relevant section. how would I do this?
many thanks
  2 件のコメント
Rik
Rik 2020 年 11 月 10 日
You can use links in such messages, but I'm not sure if you can taget a specific section of a doc page. That might also be subject to change without warning over several releases.
nathan blanc
nathan blanc 2020 年 11 月 10 日
how do i use a link? can you give me a link?

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

採用された回答

Adam Danz
Adam Danz 2020 年 11 月 10 日
編集済み: Adam Danz 2020 年 11 月 10 日
How to add a hyperlink to warning message
% Define message that will appear when user clicks hyperlink.
explanation = ['Here is a long explanation '...
'that the user can access by clicking '...
'on a hotlink in the command window.'];
% Create the hyperlink
hotlinkcode = sprintf('Click <a href="matlab: disp(''%s'') "> this link </a>', explanation);
% Throw warning that includes hyperlink
warning('Warning message. %s', hotlinkcode)
Warning: Warning message. Click this link
Here's the result when clicked:
Other hyperlink ideas
  • This answer shows how to set up a hyperlink that opens an m-file to a specific line number.
  • This answer shows how to insert a hyperlink in a dialog box that opens a website.
  2 件のコメント
nathan blanc
nathan blanc 2020 年 11 月 10 日
amazing! exactly what i was looking for. thanks a lot
Adam Danz
Adam Danz 2020 年 11 月 10 日
glad I could help

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModeling and Prediction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by