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

1 次查看(过去 30 天)
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

回答(1 个)

Walter Roberson
Walter Roberson 2018-10-15
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 个评论
Walter Roberson
Walter Roberson 2018-10-15
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 2018-10-15
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) = [];

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by