How can solve the error is Undefined function 'size8cut' for input arguments of type 'uint8'.
1 view (last 30 days)
Show older comments
Hello, can anyone help me with the following problem matlab:
I have the function:
function Y=size8cut(X) % cut the rim of the image, to make it more fit to be cut into 256*256 patches
[m,n] = size(X);
if mod(m,8)~=0
X=X(1:m-mod(m,8),:);
end
if mod(n,8)~=0
X=X(:,1:n-mod(n,8));
end
Y=X;
end
the error is
Undefined function 'size8cut' for input arguments of type 'uint8'.
If anyone knows how to solve the problem, please I need to solve it urgent.
Thank
2 Comments
Jan
on 28 Apr 2015
Do not post the question as a comment in addition. I recommend to avoid the term "urgent" carefully. The users of this forum are volunteers and nobody wants to be pushed.
Answers (3)
John D'Errico
on 28 Apr 2015
When you write a function m-file, you need to save it as a .m file on your search path.
Do NOT put it in the MATLAB toolbox directories. MATLAB does not look there for new functions.
help addpath
help savepath
which size8cut -all
1 Comment
Jan
on 28 Apr 2015
Note: A simplification:
function X = size8cut(X)
% cut the rim of the image, to make it more fit to be cut into 256*256 patches
[m, n] = size(X);
X = X(1:m-mod(m,8), 1:n-mod(n,8));
end
Walter Roberson
on 6 May 2015
How are you invoking your size8cut function? If you are invoking it from within other code, then it is possible that the other code is changing directories (or even the path) so that size8cut can no longer be found. Try adding your directory C:\Users\ismail\Desktop\QA_release\QA_release specifically to the MATLAB path instead of relying on it being found in the current directory.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!