fullfile returns error. how to properly use it to perform this code below

9 views (last 30 days)
i am trying to simulate the MEEM tracking algorith but when i run i got the following error that is difficult for me to solve
>> demo
Error using horzcat
The following error occurred converting from logical to char:
Conversion to char from logical is not possible.
Error in MEEMTrack (line 29)
D = dir(fullfile(input,['*.', ext]));
how can i solve it?
  2 Comments
Adam
Adam on 14 Nov 2017
You haven't told us what ext is.
You can debug and easily look what this is yourself and whether you can concatenate it with '*.' or not.

Sign in to comment.

Accepted Answer

OCDER
OCDER on 14 Nov 2017
Seems like ext is a logical value with the value of 1 or 0. The following will give you the same error message:
['a' 1>0] %Error: Conversion to char from logical is not possible.
Probably not an issue with your variable input, since a different error would result like this:
fullfile(1>0, ['*.jpg']) %Error: All inputs must be character vectors or cell arrays of character vectors.
Use the debugger tool or print out the variables before the error:
disp(input)
disp(ext)
disp(fullfile(input,['*.', ext]))
Also, DO NOT label your variable as " input ", as this is a function in Matlab for asking users for inputs. See doc on input

More Answers (0)

Community Treasure Hunt

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

Start Hunting!