|
QUESTION:
Why do I get the statement
"Warning: FFT on values of class UINT8 is obsolete" when I run a MATLAB
function?
ANSWER:
In MATLAB
versions 5.1 through 6.5, the FFT functions (fft, ifft, fft2, ifft2, fftn,
and ifftn) all supported uint8 and uint16 inputs. The FFT functions always
converted these inputs to double-precision and returned double-precision
results.
Partially
motivated by the new support in MATLAB 7 for single precision arithmetic and
FFTs, the MATLAB 7 FFT functions issue a warning message when you call them
with uint8 and uint16 inputs. For example:
>> f =
uint8(ones(100,100));
>> g = fft(f);
Warning: FFT on values of class UINT8 is obsolete.
Use FFT(DOUBLE(X)) or FFT(SINGLE(X)) instead.
> In uint8.fft at 10
The intent was
to motivate users to choose for themselves whether to perform the FFT
computation in double precision or in single precision. You can just ignore
the warning, since it does not indicate a problem with the computation you
performed. Or you can eliminate the warning by either:
* Converting
the input to double or single yourself, as in:
>> g =
fft(double(f));
>> g =
fft(single(f));
* Suppressing
the warning message like this:
>> warning off
MATLAB:fft:uint8Obsolete
Many but not
all warning messages in MATLAB can be suppressed by the user with this
technique. When you see a warning message and want to know if you can
suppress it, use the lastwarn function:
>> [message,
message_id] = lastwarn
If message_id
is nonempty, then you can use it to suppress the warning message. To see
how, let's return to the fft example:
>> f =
uint8(ones(100,100));
>> g = fft(f);
Warning: FFT
on values of class UINT8 is obsolete.
Use FFT(DOUBLE(X)) or FFT(SINGLE(X)) instead.
> In uint8.fft at 10
>> [message,
message_id] = lastwarn
message =
FFT on values of class UINT8 is obsolete.
Use FFT(DOUBLE(X)) or FFT(SINGLE(X)) instead.
message_id =
MATLAB:fft:uint8Obsolete
>>
warning('off', message_id)
|