Choosing which value to display
1 view (last 30 days)
Show older comments
asedsads asdsaxxz
on 21 Apr 2014
Commented: Joseph Cheng
on 21 Apr 2014
I have 5 value, let say A,B,C,D,E. The user got to choose which one(can be more then one),to be display.(I.e, the user choose to look at the value of A,D and E only). What function should i use to display the value accordingly to what the user want. I cannot use if and else function as the option for my value is more then 10. It is going so hard to cover all the possibilities. Please help someone....
0 Comments
Accepted Answer
Walter Roberson
on 21 Apr 2014
Consider using a button group of toggle buttons http://www.mathworks.com/help/matlab/ref/uibuttongroup.html. When it is time to display items, get() the Children of the uibuttongroup and get() their Value property to determine whether each one is on or off. You can easily build up a logical array of Display / Don't values this way that you can use in a loop or as a logical index as appropriate.
2 Comments
Joseph Cheng
on 21 Apr 2014
you can use a for loop and a switch/case statement. the for loop will iterate through the number of selections the user selected and the switch/case statement will contain the code for displaying that specific selection.
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!