Info
This question is closed. Reopen it to edit or answer.
Help needed on plotting!
2 views (last 30 days)
Show older comments
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!
0 Comments
Answers (3)
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.
0 Comments
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
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!