while true
clc;
warning('off','images:initSize:adjustingMag');
loadimg = imread(full_filename);
end
This is an infinite loop, which processes the same image again and again. I assume that omitting the "while true" solves the problem directly.
If some warnigns would be shown, clc will hide them soon. Therefore I never use this function, because the output to the command window contains valuable debug information.
Note: Polling wastes some processing time, therefore an callback approach might be more usefull. But I'm not sure how this can be compiled and in works under Windows only:
w = System.IO.FileSystemWatcher(pwd);
w.Filter = '*.jpg';
w.NotifyFilter = System.IO.NotifyFilters.LastWrite;
w.NotifyFilter = System.IO.NotifyFilters.DirectoryName
w.NotifyFilter = w.NotifyFilter Or System.IO.NotifyFilters.FileName
w.NotifyFilter = w.NotifyFilter Or System.IO.NotifyFilters.Attributes
w.IncludeSubdirectories = True
addlistener(w, 'Changed', @changedFcn);
w.EnableRaisingEvents = true;
function changedFcn(obj, eData)
fprintf('Changed: %s\n', char(eData.FullPath));
...
end
Best Answer