How can you open figures using MATLAB compiler?

3 ビュー (過去 30 日間)
David Nickalls
David Nickalls 2018 年 7 月 4 日
編集済み: David Nickalls 2018 年 7 月 5 日
I've run into a problem using MATLAB compiler. I want to copy a line from one plot figure to a different plot figure. I have achieved this with the following code:
fg1 = open(Figure1);
fg2 = open(Figure2);
ax1 = get(fg1, 'Children');
ax2 = get(fg2, 'Children');
ax2p = get(ax2(2),'Children');
copyobj(ax2p(3), ax1(2))
close
It leaves open the first figure with an extra line that was copied from the second.
When I compile this and attempt to call this code I get the error:
Warning: The Open function cannot be used in compiled applications.
This appears in the windows command shell when the code is called, not at compile time. This question has already been asked, with no luck (hence my alternate question [now edited to reflect solution]).
Thanks in advance for any help I may get!
  1 件のコメント
David Nickalls
David Nickalls 2018 年 7 月 4 日
編集済み: David Nickalls 2018 年 7 月 4 日
Any advice would be appreciated, if a solution is reached(/advances are made) that does(/do) not relate to the original question I will edit it accordingly.

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

採用された回答

Jan
Jan 2018 年 7 月 4 日
編集済み: Jan 2018 年 7 月 4 日
With HG2, which was introduced in R2014a, you cannot access a fig file without creating the function. While open is not the best solution to open a fig file, openfig should work.
This thread looks, like open is expected to work in compiled applications: https://www.mathworks.com/matlabcentral/answers/93025-why-am-i-unable-to-use-open-to-open-a-fig-file-in-stand-alone-mode-using-matlab-compiler-4-0-r14 . But this might matter the older HG1 graphics interface.
  1 件のコメント
David Nickalls
David Nickalls 2018 年 7 月 5 日
Thanks very much Jan. Worked a treat! As a relative novice at MATLAB (and all coding for that matter) your answers on this site are always very helpful.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by