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 Kommentare

Akanchha  Tiwari
Akanchha Tiwari am 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
Stephen23
Stephen23 am 27 Apr. 2019
@Akanchha Tiwari: read the answer below, it explains the bug in your code.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

John D'Errico
John D'Errico am 7 Feb. 2015
Bearbeitet: John D'Errico am 27 Apr. 2019

3 Stimmen

Perhaps the problem is with your typing or your spelling. ;-)
While unit8 does not exist, uint8 does.
MATLAB can be so picky.

5 Kommentare

Dee T
Dee T am 7 Feb. 2015
Thank you!! I've been reading it as UNIT8! It's my first time using Matlab...
John D'Errico
John D'Errico am 10 Feb. 2015
The funny thing is I've done exactly the same thing, too frequently. It is a simple typo for me since I do know the spelling, but every once in a while, my (apparently dyslexic) fingers just desperately want to type unit8. Or, since I type without looking at the keyboard, so maybe it is just habit - that when my mind is thinking "uint", the part of my mind that subconsciously controls my fingers to type just sends out the more common word: "unit".
Sean de Wolski
Sean de Wolski am 10 Feb. 2015
If I had a dollar for every time I've typed "unit8"...
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
Stephen23 am 28 Apr. 2019
Bearbeitet: Stephen23 am 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!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 7 Feb. 2015

Bearbeitet:

am 28 Apr. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by