马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
程序的功能是输入一个矩阵,矩阵大小在【0,1】要绘制类似这样的立方图:
bar3
我的程序直接是从Matlab里面拷出来的,不好使,经常有这样的错误: Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
Warning: size(CData) must equal size(ZData) or size(ZData)-1 for flat shading
源代码: %======================================= function Success=My_bar3(Z,varargin)
%% function to draw bar3, from matlab codes.
% format: Success=My_bar3(Z,'Yes'); % format:Success=My_bar(Z);
%% if nargin==1
Request_Shading='No';
else
Request_Shading=varargin{1};
end
[m,n]=size(Z);
h = bar3(Z);
for i = 1:length(h)
zdata = ones(6*length(h),4);
k = 1;
for j = 0:6:(6*m-6)
zdata(j+1:j+6,:) = Z(k,i);
k = k+1;
end
set(h(i),'Cdata',zdata)
end
colormap cool
colorbar
if strcmp(Request_Shading,'Yes')
shading interp
for i = 1:length(h)
zdata = get(h(i),'Zdata');
set(h(i),'Cdata',zdata)
set(h,'EdgeColor','k')
end
end
Success='Yes';
end
%=======================================
So many thanks!
|