필터 지우기
필터 지우기

Adding a GUI to existing code

조회 수: 6 (최근 30일)
A La
A La 2011년 5월 16일
편집: Rik 2019년 12월 9일
I was given some code and was asked to update it with some push buttons. My question is, what is the most efficient way of doing this, should I code push buttons with a uicontrol or should I use a GUI via GUIDE to code the buttons, and is it possible to put a GUI into already existing code?

답변 (2개)

Andy
Andy 2011년 5월 16일
When you say you were "given some code" and you want to "put a GUI into already existing code", do you mean you have a function that you want to run whenever a button in a GUI is pushed? If so, just create a GUI with a button, and in the callback call your function.
  댓글 수: 1
Matt Fig
Matt Fig 2011년 5월 16일
A La says,
No, this code I was given triggers LED lights in a particular order then asks you a question. Right now the answers to the question are in a popup menu but we want to switch that menu to three pushbuttons. So the 3 buttons represent the answers and once a button is pushed will trigger the next trial.
This code is a GUI but what I was given is the raw code, not the menus you see in the tutorials. So I was wondering if I could somehow program the buttons using the GUIDE and embed that into the existing code. Does this make sense? Sorry I am a novice at matlab

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


Paulo Silva
Paulo Silva 2011년 5월 16일
Put all the code inside a function if you haven't already, create a figure to hold the buttons and other GUI objects, add your buttons to the figure.
You have all the info in your MATLAB documentation and examples.
  댓글 수: 2
NICOLE MIN
NICOLE MIN 2019년 12월 9일
편집: Rik 2019년 12월 9일
Hi
Can you teach me how to do it? Where can I find the documentation ?
I have my own code for programming an ECG signal and now I want to create a GUI app using guide. However I have troubles putting all my code function to the push button
Rik
Rik 2019년 12월 9일
I would discourage you from using GUIDE, for reasons discussed here. In that thread you will also find advice about how to proceed. If you have any further issues, don't hijack someone elses question and post your own.

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

카테고리

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