How to obtain radio button index in APP Designer

6 次查看(过去 30 天)
I'm new to APP Designer. I've made a simple APP that has radio buttons which correspond to the names of the columns in an ascii file that I have read in. I want to plot different columns of the file (e.g. Time vs Pressure, Time vs Temperature, etc.) when I select a button.
so, when I click on a button, I want to plot columns 1 vs buttonnumber e.g
plot(app.UIAxes,app.data(:,1),app.data(:,buttonnumber))
in the UIAxes. How do I get the button number from the buttonclick callback? I don't see it in the properties of the buttongroup.

采纳的回答

Greg
Greg 2018-8-30
编辑:Greg 2018-8-30
There are a few ways to do it, each with a different level of impact to your code. The way that requires no changes except a new line of code to define buttonnumber is:
buttonnumber = ismember(app.grpRadioButtons.Buttons,app.grpRadioButtons.SelectedObject);
Obviously, you'll have to put in your own appropriate tag for the radio button group. Also, I personally wouldn't use the variable name buttonnumber since this is strictly a logical output (which works exactly as-is to index into data). If you truly (superfluously) want the numeric value, throw a find on it.
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by