APP DESIGNER ERROR: Index exceeds the number of array elements (14).

Answers (1)

Follow the steps provided in this answer to determine the issue.

3 Comments

% Button pushed function: FINDINDEXButton
function FINDINDEXButtonPushed(app, event)
list = str2num(app.INPUTARRAYEditField_2.Value); % get input array
sorted_list = num2str(quick_sort(list,1,numel(list)));
value = str2num(app.INPUTFORSMALLESTELEMENTINTHEARRAYEditField.Value);
result = sorted_list(value);
app.RESULTEditField.Value = result;
end
When I search for 2 then it must be 23, but now it has seen 1.
What are you trying to accomplish?
Sorted list is a string array containing a single element. You appear to be trying to index it like it is a numeric vector. Don't convert it to a string until you are ready to write it back to the edit field.
I want to find i'th smallest element in the array.

Sign in to comment.

Asked:

on 11 Jan 2021

Edited:

on 11 Jan 2021

Community Treasure Hunt

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

Start Hunting!