필터 지우기
필터 지우기

Hyperlink to PDF in Matlab plot

조회 수: 3 (최근 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 CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by