필터 지우기
필터 지우기

Need help how to develop an gui with callbacks

조회 수: 2 (최근 30일)
Karthik KJ
Karthik KJ 2012년 5월 19일
Hi,
I would like to create an GUI , which basically to plot the statistics(mean,Min,Max). I have an sensor list for x and y cordinate. I would like to plot the statistics. I have loaded the sensor list into the listbox and added the plotting details in the listbox callback. So whenever I click the x and y axis entries, i will check whether checkbox for mean, min or max is checked in or not and plot the same. But what i want is, if the user check out the mean or min checkbox, then it should remove the mean or min plot from the figure. How can i do this, whether any callbacks can help on this.
I can do this by coding the plot commands in the check box callback for mean and min. But is that the way to do ? then whereever i have checkbox then i have to copy my plot commands.
Please suggest if i uncheck an checkbox, then the control should go towards listbox callback and execute the plotting commands after checking the status of checkbox for mean,min,max and then plot the same.

답변 (1개)

Ketan
Ketan 2012년 5월 20일
You could write a helper function that performs the plotting. The listbox callback and the checkbox callbacks could all call this helper function. This way you do not have to replicate plotting code in two different locations.
  댓글 수: 2
Karthik KJ
Karthik KJ 2012년 5월 21일
Hi Ketan, Thankyou, Just to confirm it, you mention to add an function as a separate .m file and call it from the Listbox/checkbox callback ?
or is there anything named 'helper' function exist, sorry this may be a stupid question.
Ketan
Ketan 2012년 7월 1일
Sorry about the super late response on this. You can define the "helper" function within the MATLAB file containing your gui callback definitions. For example, if you are using guide you can define it below all of the auto-generated callback functions.

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

카테고리

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