⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makeimag.m

📁 线性代数实验及MATLAB入门,电子工业出版社出版 陈怀琛 龚杰民合著
💻 M
字号:
function A=makeimag(n,imag,back)
% The command A=makeimag(n,imag,back) lets 
% the user create an n-by-n image with imag 
% and back being the image and background 
% colors,respectively, based on the current 
% colormap. Click with the mouse to toggle 
% to toggle a square between background and 
% image color. Type q when done.
%
% Default image and background colors are 
% used if only one input argument is specified.
subplot(1,1,1)
if nargin==1, imag=27; back=1; end
if nargin==2, back=1; end
A=ones(n)*back;
image(A);axis('square')
while 1
   [x,y,z]=ginput(1);
   if abs(z)=='q'
      break
   elseif (x>=1) &(x<n+1) & (y>=1) &(y<n+1)
      x=fix(x); y=fix(y);
      if A(y,x)==back
         A(y,x)=imag;
      else
         A(y,x)=back;
      end
      image(A); axis('square')
   end
end
close

⌨️ 快捷键说明

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