I have a matrix of values of type single that I want to plot as a surface. When I attempt to use the surf function in MATLAB, I get an error specifying I need to use uint8 or double instead:
x=peaks; %# Initialize x to a matrix of doubles
surf(x); %# No problem when x is of type double
Now I'll try singles:
x=single(peaks);
surf(x);
Gives the following error:
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
Well that's unfortunate. I guess I'll have to increase to double precision for the colormap:
x=single(peaks);
surf(x,double(x));
Works just fine. But just for kicks let's try uint8 as well:
x=single(peaks);
surf(x,uint8(x));
Yields the following:
Warning: CData must be double or single unless it is used only as a texture data
Warning: CData must be double or single unless it is used only as a texture data
What the heck MATLAB? Make up your mind! So why is it that I have to use extra memory in the form of double precision to denote the colormap for the surf
function? Even when MATLAB error text tells me I can use uint8 or single, depending on whichever one I didn't use?