フィルターのクリア

create plot object for future use

13 ビュー (過去 30 日間)
Raúl
Raúl 2013 年 6 月 25 日
Hi all,
I would like to create a plot object. I mean, to use the drawn plot for future uses along the same script.
For example I have the following line:
lineh=plot(x,y,'-rd','LineWidth',1.5);
x and y are series of values. This command generates a line depending on the values of x and y. I would like to keep this line in an object in order to draw it again at the end of the script. Is it possible?
Thanks in advance.
Raúl.

採用された回答

per isakson
per isakson 2013 年 6 月 26 日
編集済み: per isakson 2013 年 6 月 26 日
AFAIK: Something like
lineh.plot
is not possible. However, define a function handle
line_fh = @() plot(x,y,'-rd','LineWidth',1.5);
now the command
line_fh()
will produce the same plot each time. Or define
line_fh = @(x,y) plot(x,y,'-rd','LineWidth',1.5);
now the command
line_fh(x1,y1)
will produce the "same" plot with the values, (x1,y1)

その他の回答 (1 件)

Jan
Jan 2013 年 6 月 25 日
See:
doc hold
lineh = plot(x,y,'-rd','LineWidth',1.5);
hold on
lineh2 = plot(x,rand(size(x),'-rd','LineWidth',1.5);
  2 件のコメント
Raúl
Raúl 2013 年 6 月 25 日
Thanks for the answer, Jan. I was looking for re-using the object 'lineh'. I mean draw 'lineh' at the end of the script for example. Able of drawing the same line by calling the object 'lineh'. I don't know if it was clear.
Jan
Jan 2013 年 6 月 27 日
Perhaps you mean:
lineh = plot(x,y,'-rd','LineWidth',1.5);
pause(2);
set(lineh, 'YData', y + 0.5);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by