how to solve the error array indices must be positive indices or logical values.
Ältere Kommentare anzeigen
the error i am getting: Array indices must be positive integers or logical values.
Error in get_im_label (line 14)
if ~strcmp(dataname(j).name(end-1:end),'db') % ËÎ
Error in demo_CURET (line 25)
imageDatasetLabel = get_im_label(imdir);
how to solve this? i have attached my code with this.
3 Kommentare
Matt J
am 12 Okt. 2018
What is the value of j at line 14 when the error occurs?
Shan Sha
am 12 Okt. 2018
Kevin Chng
am 12 Okt. 2018
how about (end-1:end), any possible that it is negative value (end-1)?
Akzeptierte Antwort
Weitere Antworten (2)
Steven Lord
am 12 Okt. 2018
0 Stimmen
If that section of code is intended to check that the file has the extension db, instead call fileparts on the filename then use isequal, strcmp, etc. to test if the third output matches .db.
Image Analyst
am 12 Okt. 2018
Try this:
if endsWith(dataname(j).name,'db','IgnoreCase',true)
% filename ends with 'db'
else
% Filename does not end with 'db'
end
endsWith() requires R2016b or later.
3 Kommentare
Shan Sha
am 14 Okt. 2018
Image Analyst
am 14 Okt. 2018
Then you should be ok. So replace all that complicated code of yours with the code I gave you.
Shan Sha
am 14 Okt. 2018
Kategorien
Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!