Info

This question is closed. Reopen it to edit or answer.

Help needed on plotting!

1 view (last 30 days)
Prakash
Prakash on 11 Jul 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
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!

Answers (3)

Image Analyst
Image Analyst on 11 Jul 2013
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 on 11 Jul 2013
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 on 11 Jul 2013
Edited: Hugo on 11 Jul 2013
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 Comment
Prakash
Prakash on 11 Jul 2013
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!

This question is closed.

Community Treasure Hunt

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

Start Hunting!