MATLAB: How to solve the error array indices must be positive indices or logical values.

array indices must be positive

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.

Best Answer

Your directory contains a name that is one character long. For example your code is not accounting for the . entry you will find in most file systems.