How would I create a GUI with a push button that when clicked, text will appear?

조회 수: 25 (최근 30일)
Caitlin Hoying
Caitlin Hoying 2017년 11월 15일
답변: Image Analyst 2017년 11월 15일
In the callback, would I need to add a text file like;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
open('C:\matlabcodes folder\readme.txt')
Additionally, is there a way to put an active link to a website in this text?
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2017년 11월 15일
Caitlin - where will the text appear? In a control on your GUI or are you opening a file? Please clarify.
Caitlin Hoying
Caitlin Hoying 2017년 11월 15일
In a control on the GUI: The text should appear after the push button is clicked, once the script is run.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2017년 11월 15일
  1. Use GUIDE.
  2. Place a button.
  3. Place a static text.
  4. Double click on the text label and set the visible property to off in the Property Inspector.
  5. Save the GUI and then go to the editor and go to the push button callback function.
  6. Put this line of code:
handles.button1.Visible = 'on'; % Make text appear.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by