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

1 Ansicht (letzte 30 Tage)
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

Antworten (1)

Walter Roberson
Walter Roberson am 15 Okt. 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 Kommentare
Walter Roberson
Walter Roberson am 15 Okt. 2018
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));
Walter Roberson
Walter Roberson am 15 Okt. 2018
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) = [];

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by