MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   如何手动绘图? (https://www.labfans.com/bbs/showthread.php?t=6692)

yanfeng39 2009-03-06 15:30

如何手动绘图?
 
我的目标是
有一个输入提示框:
---------------------------
请输入第一点(或从图中指定):

请输入第二点(或从图中指定):

——————————
然后根据这两点在图中画一条直线。
有两个问题:
(1)如何手动地在坐标图中绘制直线?
(2)如何控制是图中定点还是编辑框输入?

新手不太熟悉,谢谢

mikewg 2009-03-06 22:19

回复: 如何手动绘图?
 
使用input命令:
例:
p1=input('input the first point'); %输入第一个点,如[1 2];
p1=p1(:);
plot(p1(1),p1(2),'+');
p2=input('input the 2nd point'); %输入第二个点,如[2,1];
p2=p2(:);
p=[p1,p2];
plot(p(1,:),p(2,:),'+'); %画直线

3061211037 2009-03-07 19:55

回复: 如何手动绘图?
 
lz可以到gui板块去,这是个很基础的问题


所有时间均为北京时间。现在的时间是 11:24

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.