I use cell array of strings to populate popup menu but strings in the popup menu are returned as scientific notation!

조회 수: 2 (최근 30일)
Dear matlab users
I have 10x1 cell array of strings: 1001001 1001002 1001003 1001004 . . . 1001010
I use this code to set the strings in the popupmenu Matlab GUI:
set(handles.popupmenu14,'String',ListNoSG);
But in the popup menu the strings are shown as scientific notations: 1.001e+06, 1.001e+06, 1.001e+06, 1.001e+06, 1.00101e+06, 1.00101e+06, 1.00101e+06, 1.00101e+06, 1.00101e+06, 1.00101e+06.
Please note that the scientific notation 1.001e+06 is repeated 4 times while 1.00101e+06 is repeated 6 times.
I want in the popupmenu to be shown strings from the cell array: 1001001 1001002 1001003 1001004 . . . 1001010
Please tell me how to do it. I tried several workarounds found on internet but without success.
Thank you in advance.

채택된 답변

Stephen23
Stephen23 2018년 7월 25일
편집: Stephen23 2018년 7월 25일
It seems that ListNoSG contains numeric scalars. Convert them to character:
tmp = cellfun(@int2str,ListNoSG,'uni',0);
set(handles.popupmenu14,'String',tmp);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by