MATLAB: Choosing which value to display

accordinglychoosewhat to display

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….

Best Answer

  • 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.