Undefined function or method 'unit8'
15 views (last 30 days)
Show older comments
I am getting this error when using unit8:
??? Undefined function or method 'unit8' for input arguments of type 'double'.
I have MATLAB Version 7.12.0.635 (R2011a) and unit8.m does not exist in MATLAB folder. Please help
Code mask=unit8(mask); eye_image=gray_image .* mask; figure, imshow(eye_image), hold on; title('Eye Image');
2 Comments
Akanchha Tiwari
on 27 Apr 2019
i got error in my code this
Undefined function or variable 'unit8'.
Error in baseme (line 34)
ima= unit8(img1); % read image
how to over come it
Accepted Answer
John D'Errico
on 7 Feb 2015
Edited: John D'Errico
on 27 Apr 2019
Perhaps the problem is with your typing or your spelling. ;-)
While unit8 does not exist, uint8 does.
MATLAB can be so picky.
5 Comments
John D'Errico
on 27 Apr 2019
I suppose, if this was too often a problem, one could define a pass-through function called unit8, that just calls uint8.
function X = unit8(varargin)
% synonym for uint8 for those who never get the spelling right
X = uint8(varargin{:});
Stephen23
on 28 Apr 2019
Edited: Stephen23
on 28 Apr 2019
"...one could define a pass-through function called unit8..."
Not convinced. That would just hide the problem even deeper, and totally flumox the user when unit8 is eventually not accessible (which it inevitably will be, e.g. when the path is changed, scope changes due to moving files around, confusion during debugging, etc). Combined with beginners' enthusiasm for (slow and anti-pattern) cd this is just asking for trouble!
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!