Programmatically create annotation with hyperlink
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello,
I have a model in which I would like to include a hyperlink to an excel file that contains more information about the model. The model and excel file are contained within the same Simulink project however I would like to be able to share the project with someone else, but maintain that hyperlink regardless of where they put the project file.
In my project open script I am getting the root directory of the project using ProjectRootDir = fileparts(mfilename('fullpath'));
and I know I can create an annotation programmatically using the methods described here: http://www.mathworks.com/help/simulink/ug/create-an-annotation-programmatically.html
But no where do I see a parameter to enable a hyperlink and create it using a Matlab variable. Is there another way to implement this?
Thanks!
Max
댓글 수: 0
답변 (2개)
Kent Schonert
2022년 5월 24일
I found a solution by looking at the properties of a GUI created hyperlink annotation.
hyperlink = 'www.google.com';
displayText = 'Google';
textValue = [...
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">' char(13)...
'<html><head><meta name="qrichtext" content="1" /><style type="text/css">' char(13) ...
'p, li { white-space: pre-wrap; }' char(13) ...
'</style></head><body style=" font-family:''Arial''; font-size:10px; font-weight:400; font-style:normal;">' char(13) ...
'<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="' hyperlink '"><span style=" text-decoration: underline; color:#0000ff;">' displayText '</span></a></p></body></html>'];
a = Simulink.Annotation(gcs,textValue);
a.Interpreter = 'rich'
;
댓글 수: 0
Rick Rosson
2014년 9월 15일
편집: Rick Rosson
2014년 9월 15일
Here are a few links that should help:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!