MATLAB Answers

0

i am getting an error that my output argument is not assigned during call of the function

Asked by Shan Sha on 15 Oct 2018
Latest activity Commented on by Walter Roberson
on 15 Oct 2018
this is my error
Output argument "imlabel" (and maybe others) not assigned during call to "get_im_label".
Error in demo_CURET (line 25)
[imlabel, impath] = get_im_label(imdir)
i have attached my code and its corresponding function with this. please tell me what to change. Thanks in advance

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 15 Oct 2018

That appears to be extracted from https://upslide.site/3-d47c7f818758ee192afc4aae9ab8dae15.html but I do not find an implementation for dir_bo() anywhere.
Your code only assigns at least one value to imlabel in the case that dir_bo(imdir) is not empty, and you find at least one .db file in directory names that dir_bo(imdir) returns.

  3 Comments

That dir_bo.m is technically incorrect, but probably you will not notice in practice... not unless you happen to be using some of the more obscure file systems.
More likely is that you are not finding any .db files in the designated locations.
Try this:
info = dir( fullfile(imdir, '**', '*.db') );
filesnames = {info.name};
fprintf('Number of db files found: %d\n', length(filenames));
Corrected version of dir_bo:
function imname = dir_bo(datadir)
% written by Liefeng Bo in University of Washington on 01/04/2011
% corrected by Walter Roberson on 20161015
% - some filesystems do not have the . or .. entries at all
% - NTFS makes no promises about the order of file system entries
% - in practice, NTFS sorts by 16 bit Unicode, which sorts
% filenames beginning with any of ' !"#$%&'()*+,-' before '.'
% - if the details of how Apple sorts filenames do not bewilder
% you, then *please* publish a technical memo explaining them
% - in practice, all current Apple filesystems sort
% filenames beginning with any of ' !"#$%&'()*+,-' before '.'
% The main difference from NTFS in this matter is that some of
% those characters are illegal in NTFS filenames but valid on Apple
% remove rootdir
imname = dir(datadir);
mask = ismember({imname.name}, {'.', '..'});
imname(mask) = [];

Sign in to comment.