Problem with listbox in Matlab GUI.
Show older comments
Warning: single-selection listbox control requires that Value be an integer within String range Control will not be rendered until all of its parameter values are valid
I have 2 listbox. First listbox is show X coordinates and second one show the correspondind Y values for each X. eg. When I press X = 100 on the second listbox I see e.g Y = 100,101,102 ect. Sometimes when I press some values on Y listbox, and after that I change value on X listbox the Y listbox disappear and the error above shows.
Picture shows how it should work

Picture shows how it work when I press value higher than 100 on Y then when I press 442 X the Y listbox disappear.

I didn'y show the code because it's a lot of code and I think it's something wrong with listbox by itself. This is working properly. When I press 442 X it's working well but the error happens under specific conditions.
Any idea what might go wrong ?
Accepted Answer
More Answers (3)
Jan
on 27 Sep 2013
The warning message is clear: The values of the 'Min' and 'Max' properties define the listbox as a single selection control. Then exactly one element must be selected. If you want to select no or multiple elements, the distance between 'Min' and 'Max' must be greater than 1. Exmaple:
h = uicontrol('Style', 'listbox', 'String', {'1', '2'}); % Ok
pause(1);
set(h, 'Value', []); % Nothing selected, warning appears
pause(1)
set(h, 'Max', 2); % Listbox appears again
Jonasz
on 28 Sep 2013
Jonasz
on 28 Sep 2013
0 votes
Categories
Find more on Language Support in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

