imgetfile() does not return the pathname, instead, it returns the full file address in the first output argument. The second argument in the output pathName is not a char variable but a boolean variable. Therefore it gives the error that cannot convert from logical to cellstr. You can simply use it like this
[fileName, isCancelled] = imgetfile();
if ~isCancelled
filenames = fileName;
end
Best Answer