我有一些代码,我在Octave中运行(但在matlab下运行得非常好),它为我运行的物理实验产生了一些图。我已经决定,如果我可以生成几百个这样的图,只需使用我的旧代码,但每次读取不同的数据文件(我使用不同的程序生成这些)将会很好。
所以我拿了旧代码:
for u=1:2
f=num2str(u)
xdim=801;
ydim=801;
%ask matlab to create a figure
figure;
filename=strcat('data',f,'.txt')
field=load(filename);
xx=field(:,1);
yy=field(:,2);
zz=field(:,3);
for i=1:xdim
x1p(i)=xx((i-1)*ydim+1);
for j=1:ydim
z1p(j,i)=(zz((i-1)*ydim+j));
end
end
for k=1:ydim
y1p(k)=yy(k);
end
grid off;
axis on;
axis equal;
%--------------------
% surface plots
%-------------------
surf(x1p,y1p,z1p);
colorbar(); %put a colorbar showing mapping
%between colors and values
title_str=strcat("A map of the Electric Field Strength: m=-5 to 5 eps=100 wa/c=",f)
title(title_str);
xlabel("x");
ylabel("y");
shading interp; %gives usually best view interpolates between grids
colormap('jet'); %choose the colormap other options hsv,cool,hot e.t.c.
jpg_str=strcat('surf_',f,'.jpg')
print -djpeg jpg_str
end
然后把它全部放在那个初始for循环中。不幸的是这个错误,返回:
multiplot> unset view;
^
line 0: Unrecognized option. See 'help unset'.
我不知道如何解决这个问题,因为我不希望在一个图像中有多个图,这就是多色图似乎的用途。我该如何解决这个问题?
感谢您的帮助!