matlab中figure如何添加一个滚动条来调整X坐标范围?具体怎么操作?

2024-12-27 07:16:54
推荐回答(2个)
回答1:

clear;
clc;

f=figure;
a=axes('position',[.1 .25 .8 .65],'units','normalized');
ezplot(@sin);
xlim([-pi,pi]);
uicontrol('units','normalized','Style','slider','userdata',a,'pos',[.1 .1 .8 .05],'min',-pi,'max',pi,'callback',@(obj,event)set(get(obj,'userdata'),'xlim',[-pi,pi]+get(obj,'value')));

回答2:

设置figure的position属性试试?