看到又有人提到GUI,所以贴一个例子,可以仿照试试自己动手编一个,
同时可以参考一些Matlab GUI的书
---点击三个新增的按钮试试.(转自萝卜)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
h = figure('ToolBar','none');
ht = uitoolbar(h);
a = [.05:.05:0.95];
b(:,:,1) = repmat(a,19,1)';
b(:,:,2) = repmat(a,19,1);
b(:,:,3) = repmat(flipdim(a,2),19,1);
hpt = uipushtool(ht,'CData',b,'TooltipString','Hello',...
'ClickedCallback','msgbox(''Hello,How are you today?'')');
J=ones(19,19,3);
for k=[1:4,15:19];
c=mod(9-2*k,19)+1;
J(c,k,1:end)=0;
end
for k=5:14;
c=mod(9+2*k,19)+1;
J(c,k,1:end)=0;
end
hpt2=uipushtool(ht,'CData',J,'TooltipString','Draw Sin',...
'ClickedCallback','t=0:pi/48:2*pi;plot(t,sin(t))');
colordata(:,:,1) = rand(19);
colordata(:,:,2) = rand(19);
colordata(:,:,3) = rand(19);
htt = uitoggletool(ht,'CData',colordata,'TooltipString',...
'Show a rand matrix','ClickedCallback',...
'R=rand(128);imagesc(R)');
%%%%%%%%%%%%%%%%%%%%%%%%%% |