matlab画出圈圈来 但是用fill函数填充颜色填充不上,代码如下,不知道是哪里的问题。
R=2.0;AgentNumber=80;FrameNumber=513;forframe=0:1:FrameNumberszBuffer=sprintf('./data...
R=2.0;
AgentNumber = 80;
FrameNumber = 513;
for frame = 0:1:FrameNumber
szBuffer = sprintf('./data_output/cmx%05d.txt',frame);
f1=fopen(szBuffer);
cla;
i=1;
while 1
nextline = fgetl(f1); %读第一行
if ~isstr(nextline), break, end %读到最后跳出
%disp(nextline);%这行可以不要
a = sscanf(nextline, '%f %f');%读取数据,根据你自己的需要改
data(i) = a(1);
data(i+1) = a(2);
i=i+2;
end
fclose(f1);
for agent = 0:1:AgentNumber-1
plot(data(agent*2+1),data(agent*2+2),'ro','MarkerSize',2);
hold on;
fill(data(agent*2+1),data(agent*2+2),'r')
axis([-100 100 -100 100]);
end
szBuffer = sprintf('./jepg_output1/cmx%05d.jpeg',frame);
print(gcf,'-djpeg',szBuffer);
end 展开
AgentNumber = 80;
FrameNumber = 513;
for frame = 0:1:FrameNumber
szBuffer = sprintf('./data_output/cmx%05d.txt',frame);
f1=fopen(szBuffer);
cla;
i=1;
while 1
nextline = fgetl(f1); %读第一行
if ~isstr(nextline), break, end %读到最后跳出
%disp(nextline);%这行可以不要
a = sscanf(nextline, '%f %f');%读取数据,根据你自己的需要改
data(i) = a(1);
data(i+1) = a(2);
i=i+2;
end
fclose(f1);
for agent = 0:1:AgentNumber-1
plot(data(agent*2+1),data(agent*2+2),'ro','MarkerSize',2);
hold on;
fill(data(agent*2+1),data(agent*2+2),'r')
axis([-100 100 -100 100]);
end
szBuffer = sprintf('./jepg_output1/cmx%05d.jpeg',frame);
print(gcf,'-djpeg',szBuffer);
end 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询