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

Baishakhi Tikader
Baishakhi Tikader 2017년 7월 3일
편집: Baishakhi Tikader 2017년 7월 3일
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 2017년 7월 3일
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.

댓글을 달려면 로그인하십시오.

 채택된 답변

Adam
Adam 2015년 6월 9일

1 개 추천

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

Alex Mussell
Alex Mussell 2015년 6월 9일
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 2015년 6월 9일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Software Development Tools에 대해 자세히 알아보기

태그

질문:

2015년 6월 9일

댓글:

2017년 7월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by