필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Help needed on plotting!

조회 수: 1 (최근 30일)
Prakash
Prakash 2013년 7월 11일
마감: MATLAB Answer Bot 2021년 8월 20일
I am trying to create a figure plot between two variables selected using check boxes located at the top of each column data.
Suppose I have a data named "data". My GUI Pushbutton should create a uitable showing listbox/ checkbox of all the column names and I should able to select any two column names and plot them in the figure plot.
Thanks!

답변 (3개)

Image Analyst
Image Analyst 2013년 7월 11일
OK, so did you create a GUI with a table control and checkboxes above each column? And a push button that says Plot which will plot the selected columns? I would not have the pushbutton create the uitable - I'd have it already created and loaded with data prior to the user selecting the columns via checkboxes. You could have a push button called "open data file" or something like that where it calls uigetfile() to let the user specify which file to load into the table.

Prakash
Prakash 2013년 7월 11일
Hey Image Analyst, thank you for your reply. I am only using one file. I have read its column names and data. Now in uitable, I want to create a x and y popupmenus each of which will show all the column names.
When I finish clicking both the popupmenus, I want to plot data of the selected x and y columnames.
Can you help me in it? And yes I have created a GUI with a push button to create a table control. I have changed my mind of not using checkboxes since they won't be practical under large number of column names.
Thanks!

Hugo
Hugo 2013년 7월 11일
편집: Hugo 2013년 7월 11일
When you push the GUI pushbutton, you can read the labels of the columns of the data into a cell array and then create the checkboxes using a for loop. The handles of the checkboxes should be an array like
hcheckbox(1) for the checkbox corresponding to column 1 hcheckbox(2) for the checkbox corresponding to column 2 and so on
That way, you can use only one callback function that should be called everytime a checkbox changes state. The callback function is the same for all checkboxes. When the callback function is called, the callback function should detect which checkbox has changed its state, which is trivial because the handle of the checkbox comes as an argument to the callback function. After that, then you should change other checkboxes accordingly, meaning that you should set all the others to "uncheck" and you should also update the plot, by selecting the column associated with the checkbox that changed state. All this inside only one callback function.
Hope this helps.
  댓글 수: 1
Prakash
Prakash 2013년 7월 11일
Hi Hugo, thanks! I am only using one file. I have read its column names and data. Now in uitable, I want to create a x and y popupmenus each of which will show all the column names.
When I finish clicking both the popupmenus, I want to plot data of the selected x and y columnames.
Can you help me in it? And yes I have created a GUI with a push button to create a table control. I have changed my mind of not using checkboxes since they won't be practical under large number of column names.
Thanks!

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by