Copy figure (short, probably some unset variable)

2 ビュー (過去 30 日間)
Matthew Merritt
Matthew Merritt 2020 年 4 月 8 日
コメント済み: matquest 2020 年 4 月 8 日
I am using R2019b Update 3 on a linux box. My figures have everything under edit from "undo" to "delete" grayed out. I can't use them in gui. Key strokes don't work either.
So I found:
h=plot(index,data)
This produces the following from matlab:
h =
2×1 Line array:
Line
Line
Then
hgexport(h,'-clipboard')
produces:
Error using hgexport
First argument must be a handle to a figure.
Do I have something setup wrong in the install? Ho come I cannot copy a figure? I can export setup as a jpg file of the figure.
Thanks in advance.
  1 件のコメント
Matthew Merritt
Matthew Merritt 2020 年 4 月 8 日
Thank you darova for making this much easier to read.

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

採用された回答

matquest
matquest 2020 年 4 月 8 日
h is the variable name, not the handle. To get the handle of the current figure you can do:
h_handle = gcf; % get current figure
hgexport(h_handle, '-clipboard');
For more general cases, see the accepted answer to this question: How do I get the handles of all open figures in MATLAB
  2 件のコメント
Matthew Merritt
Matthew Merritt 2020 年 4 月 8 日
So copying to clipboard is not supported on linux systems? Really??
gexport(h_handle,'-clipboard')
Error using hgexport
Copying to clipboard is not supported on this platform.
matquest
matquest 2020 年 4 月 8 日
@Matthew Merrit I think you're right! I just tried it on my linux box and got the same error. How disappointing. If you step into the hgexport function, the first thing is a call to ispc.m - which returns 0 if you're not running on a pc. I wonder if there are platform-specific system calls in the 'undo', 'delete', etc. callback functions and that's why the buttons are greyed out...
There's probably some other workaround, but I don't know what it'd be off the top of my head.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by