I have been working on some code for a while now. I was testing a new part of the code, and an error message occured that had nothing to do with the part of the code I was testing. The error message was
Warning: single-selection list box control requires that Value be an integer within String range Control will not be rendered until all of its parameter values are valid
I commented this code out
set(handles.viewableCycles,'string',{cycleList})
When I ran all the code again the message disappeared. So then I uncommented it and ran it again, but the error did not appear. The code that I commented out sets the values that you can select in a list box (GUI). When the error originally appeared the list box disappeared in the GUI. Also, after the error stopped appearing, the program worked and the list box displayed the values. cycleList is an array of 55 values. handles.viewableCycles is the list box
What does the error mean and how can commenting code out and undoing the comment fix the code?

2 commentaires

Baishakhi Tikader
Baishakhi Tikader le 3 Juil 2017
Modifié(e) : Baishakhi Tikader le 3 Juil 2017
Hi Everyone,
I am a student working with MATLAB academic liscense.
I am using a software which is MATLAB based for optimization. I am using MATLAB2015b. When I am trying to run a particular method of optimization of that software I am getting some error.
Please help me out
Adam
Adam le 3 Juil 2017
Why are you adding this as a comment to a seemingly completely unrelated thread from 2 years ago?!
If it is important start a new question and give plenty of details to help people help you.

Connectez-vous pour commenter.

 Réponse acceptée

Adam
Adam le 9 Juin 2015

1 vote

I'm not sure about its sporadic appearance, but in terms of what the error means:
A listbox has a set of strings that can be chosen from and a 'Value' field which specifies an index into that list. If the 'Value' is greater than the number of elements in the string you get that error. This can often occur if you repopulate a listbox with varying numbers of items when an item towards the bottom of the previous longer list was the one selected.
Sliders have similar behaviour with respect to not rendering themselves if your min, max, value and step settings don't make mathematical sense with respect to each other.

2 commentaires

Alex Mussell
Alex Mussell le 9 Juin 2015
Thank you. I guess when I reran the code I hadn't opened the larger list yet, I started with the shorter list so the error did not occur. Is there a way to load a shorter list after a longer list without this error occuring? Do I just need to clear the list box first, and if so how do I clear it?
Walter Roberson
Walter Roberson le 9 Juin 2015
When you load a new list into a listbox you should set the Value parameter to either [] or 1, unless you have a particular reason to have a different entry pre-selected.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Software Development Tools dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by