使用print指令,Matlab环境下可用,VC编译后不得行。哪位大哥大姐给讲讲如何解决?function YB3DPic(input,type,output)
%input - 参数所在的文件名TXT
%output - 保存图像的文件名JPG
%type -绘制的图像类型% 读取坐标数据
%[X Y Z] = textread(input,'%f %f %f') ;[X,Y] = meshgrid(-2:.4:2, -2:.4:2);
Z = sin(X).* sin(Y).* ...
exp(-X.^2 - Y.^2);%绘图
switch type
case 1
plot3(X,Y,Z)
case 2
mesh(X,Y,Z)
case 3
surf(X,Y,Z)
case 4
surf(X,Y,Z)
colormap(hot(15))
shading interp
case 5
surfl(X,Y,Z)
colormap(jet)
case 6
surf(X,Y,Z)
colormap(jet)
light
case 7
surf(X,Y,Z)
colormap(jet) f = findobj('Type','surface');
set(f,'FaceLighting','phong'); material shiny
shading interp
light
end%输出
print('-djpeg100', output)解决后,再给100分。
%input - 参数所在的文件名TXT
%output - 保存图像的文件名JPG
%type -绘制的图像类型% 读取坐标数据
%[X Y Z] = textread(input,'%f %f %f') ;[X,Y] = meshgrid(-2:.4:2, -2:.4:2);
Z = sin(X).* sin(Y).* ...
exp(-X.^2 - Y.^2);%绘图
switch type
case 1
plot3(X,Y,Z)
case 2
mesh(X,Y,Z)
case 3
surf(X,Y,Z)
case 4
surf(X,Y,Z)
colormap(hot(15))
shading interp
case 5
surfl(X,Y,Z)
colormap(jet)
case 6
surf(X,Y,Z)
colormap(jet)
light
case 7
surf(X,Y,Z)
colormap(jet) f = findobj('Type','surface');
set(f,'FaceLighting','phong'); material shiny
shading interp
light
end%输出
print('-djpeg100', output)解决后,再给100分。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货