Basic menu with options
显示 更早的评论
1)I have a menu with 4 options. I need to make another menu that has all the options from the previous menu except the option that was previously selected. What do I do?
2)My code uses the option number outputed from the menu to extract a value from a matrix. On the second menu, one option will be removed so the outputted number will not extract the correct matrix values anymore. Is there anyway I can keep the same values on the second menu as the first menu after one option is removed?
EX) If someone selects option 2 from the first menu my code is set up to put the value into value=matrixname(option#selected, columnnumber)
if one option is removed it will not extract the correct value anymore. What should I do?
回答(1 个)
"Is there anyway I can keep the same values on the second menu as the first menu after one option is removed?"
Instead of using the option number from the menu, match the selection to an independent list that won't change.
allPossibleOptions = {'white','green','red','blue'};
selection = 'red';
value = find(strcmp(allPossibleOptions,selection));
1 个评论
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Environment Customization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!