Error in pop-up menu for GUI
Show older comments
Hello everyone! I build a GUI for a main code that I have and based on the GUI, the user is supposed to enter a number, N. Once the number is entered, N is used to generate the list of a popup menu. example of list:
N = 3
User 1
User 2
User 3
my code and GUI functions properly, except when N is greater than 9. Then, instead of displaying User 10 in the pop up menu list, it is displaying User 1 User 0. This is occurring for all 2 digit numbers.
I tried a lot of options but none are actually working and I really need help! If anyone knows how to fix this, please help me!
This is the code I used:
for k = 2:(N+1)
string2{k} = sprintf('User %1.0g\n',(num2str((k-1),2)-48));
end
set(handles.popupmenu2,'String',string2)
Thank you
Accepted Answer
More Answers (0)
Categories
Find more on Interactive Control and Callbacks 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!