Info

此问题已关闭。 请重新打开它进行编辑或回答。

Help needed on plotting!

2 次查看(过去 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