myset=[1 2 3 4 6]; capacity=6; passedall=[] passed=[] for q = 1:5
q=q+1 capacity=6; passedall = [passedall passed]; myset= setdiff(myset,passedall);
for b= 1:5 if (myset(b) < capacity);
capacity= capacity - myset(b) passed(b) = myset(b) end end end
i get this error:
error: myset(4): out of bound 3 error: called from deneme at line 13 column 5
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
2 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/425205-why-i-get-the-out-of-bound-error-in-this-code#comment_625544
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/425205-why-i-get-the-out-of-bound-error-in-this-code#comment_625544
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/425205-why-i-get-the-out-of-bound-error-in-this-code#comment_625549
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/425205-why-i-get-the-out-of-bound-error-in-this-code#comment_625549
Sign in to comment.