Hyperlink to PDF in Matlab plot

7 ビュー (過去 30 日間)
Daniel Liberman
Daniel Liberman 2020 年 3 月 10 日
回答済み: Daksh 2023 年 2 月 2 日
Hi, I have a GUI in which the user opens 4 popupmenus one after another and then is asked to enter coordinates and diameters of multiple circles. After doing this, the GUI presents a plot of the circles. I would like to add hyperlinks to the plots so the for each circle, a different PDF/word/text file is opened. The file should be also different for every selection of choices in the popupmenus How can I do that?

回答 (1 件)

Daksh
Daksh 2023 年 2 月 2 日
I understand you have a GUI figure with plots in MATLAB for which you intend to attach hyperlinks to PDFs or other files available.
You can do so by adding "uibutton" in GUI figure, and then writing a MATLAB function for action when button is pressed. Inside the method call, you can open the PDF file link and this can serve as a hyperlink. You can also add multiple buttons of different shapes, sizes and forms and configure method calls for each of them
Here is an example
function buttonPlot
% Create a figure window
fig = uifigure;
% Create a push button
btn = uibutton(fig,'push',...
'Position',[420, 218, 100, 22],...
'ButtonPushedFcn', @(btn,event) plotButtonPushed(btn));
end
% Create the function for the ButtonPushedFcn callback, which opens
% "file101.pdf", a dummy pdf to be opened
function plotButtonPushed(btn)
disp("Opening relevant PDF file")
open('file101.pdf');
end
Hope this helps!

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by