waitforbuttonpress 函数
k = waitforbuttonpress; %返回值为0代表点击了鼠标按键,返回值为1代表按键被按下
example:
%% Plot
for plot_iter = 1:trials
figure;
subplot(2,1,1);
plot(1:(L+1),x(1:2:end,plot_iter+1),‘b’,1:(L+1),x_real(1:2:end,plot_iter+1),‘g’,1:(L+1),x_hat(1:2:end,plot_iter+1),‘r’);legend(‘x1’,‘x1 real’,‘x1 hat’);
subplot(2,1,2);
plot(1:(L+1),x(2:2:end,plot_iter+1),‘b’,1:(L+1),x_real(2:2:end,plot_iter+1),‘g’,1:(L+1),x_hat(2:2:end,plot_iter+1),‘r’);legend(‘x2’,‘x2 real’,‘x2 hat’);
waitforbuttonpress;
close all;
end
另一个读取按键的函数:strcmpi(get(gcf,‘CurrentCharacter’),‘n’);%n为期望按键键值。
以上。
最后
以上就是深情柚子最近收集整理的关于matlab等待按键/鼠标函数的全部内容,更多相关matlab等待按键/鼠标函数内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复