Info
此问题已关闭。 请重新打开它进行编辑或回答。
Help needed on plotting!
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
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.
0 个评论
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 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!