plotcell.m

来自「多智能体工具包」· M 代码 · 共 58 行

M
58
字号
function plotcell(CELL,Age)% PLOTCELL	Plot the current locatin of the cell.%     Copyright (c) 1997-2000 Jiming Liu and Jianbing WuCurrent_X=0;Current_Y=0;Visible_Width=10;End_X=Current_X+Visible_Width; End_Y=Current_Y+Visible_Width;Cell_Size=size(CELL);clg;axes('position',[0.1 0.89 0.8 0.1]);axis off;axis([0 100 0 100]);Fig_Title=['Step: ' int2str(Age)];text(0,50,Fig_Title);axes('position',[0.1 0.08 0.8 0.8]);plot(Current_X,Current_Y,'color',[1 1 1]);axis([Current_X,End_X,Current_Y,End_Y]);axis on;hold on;for mm=1:Cell_Size(1)  Class_Id=CELL(mm,1);  LocationX=CELL(mm,3);  LocationY=CELL(mm,4);  if LocationX<=End_X & LocationX>=Current_X ...         & LocationY<=End_Y & LocationY>=Current_Y    if Class_Id==0      Cell_Color='g';      Line_Style='+';      Marker_Size=100/Visible_Width;    elseif Class_Id==1      Cell_Color='r';      Line_Style='*';                     Marker_Size=75/Visible_Width;    elseif Class_Id==2      Cell_Color='b';      Line_Style='*';                     Marker_Size=75/Visible_Width;    elseif Class_Id==3      Cell_Color='w';      Line_Style='.';                     Marker_Size=200/Visible_Width;    end    plot(LocationX,LocationY,'LineStyle',Line_Style,'Color',Cell_Color,...                 'markersize',Marker_Size);  end  drawnow;end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?