Error in pop-up menu for GUI
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!