4
我有一個矩陣的單值類型,我想繪製爲曲面。當我嘗試使用MATLAB中的衝浪功能,我得到一個錯誤,指定我需要使用UINT8或翻番,而不是:爲什麼MATLAB surf功能不能處理單精度數據?
x=peaks; %# Initialize x to a matrix of doubles
surf(x); %# No problem when x is of type double
現在,我會盡力單打:
x=single(peaks);
surf(x);
提供了以下錯誤:
Warning: CData must be double or uint8.
Warning: CData must be double or uint8.
那麼這是不幸的。我想我必須增加到雙精度的色圖:
x=single(peaks);
surf(x,double(x));
工作得很好。但只是踢,讓我們嘗試UINT8還有:
x=single(peaks);
surf(x,uint8(x));
產生如下:
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
什麼鬼MATLAB?下定決心!那麼,爲什麼我必須以雙精度的形式使用額外的內存來表示surf
函數的顏色映射?即使當MATLAB錯誤文本告訴我,我可以使用uint8 或單,取決於哪一個我沒有使用?
這是一個有趣的解決方案,但並不真正適合我的問題。我需要更多的色彩分辨率。我想我只是想用'surf(x,double(x))'這個解決方案。 – Doresoom 2012-03-07 15:38:12