Is there any way to save ANN view to eps in newer releases of MATLAB?

1 回表示 (過去 30 日間)
Karol P.
Karol P. 2023 年 2 月 18 日
コメント済み: Karol P. 2023 年 3 月 6 日
I'm looking for a way to export the output of view(ANN) command to eps. In older version of Matlab it was possible by accesing a handle to jframe as a workaround (original idea):
load net_data
jframe = view(net1);
%# create MATLAB figure
hFig = figure('Menubar','none', 'Position',[100 100 800 300]);
jpanel = get(jframe,'ContentPane');
[~,h] = javacomponent(jpanel);
set(h, 'units','normalized', 'position',[0 0 1 1])
%# print to file
saveas(hFig, 'out.png')
But in newer releases view() method does not give output, so it will end with the error:
Error using network/view
Too many output arguments.
Is there any other way to do this, or is this functionallity permamently blocked in newer versions?
  2 件のコメント
Rajeev
Rajeev 2023 年 2 月 20 日
Have you tried using the 'plot' function instead of 'view'?
Karol P.
Karol P. 2023 年 2 月 20 日
編集済み: Karol P. 2023 年 2 月 20 日
ANN is stored in structure, and cannot be displayed using 'plot' method. For 'Plot' the data must be numeric, datetime, duration or an array convertible to double, but in this case it's clearly not.

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

採用された回答

Ajay Gajulapally
Ajay Gajulapally 2023 年 3 月 3 日
Hi Karol,
I understand that you want to export the view(ANN) and save it as a file. But view(ANN) doesnot return any output in the latest versions of MATLAB.
As a workaround you can try this:
  • Find the handle of view(ANN) using the code below. Make sure there are no other figures opened other than this.
h = findall(groot,'Type','Figure');
  • This is a uifigure handle. But MATLAB doesnot support "save" or getting the value of "ContentPane". Hence you can try to use "exportapp" function.
exportapp(h,'File_Name.png');
  • Now you can open your png file to see your image. Hope this helps!
  3 件のコメント
Ajay Gajulapally
Ajay Gajulapally 2023 年 3 月 6 日
Hi Karol,
Run it command by command, instead of copy pasting all commands in command window and trying to execute simultaneoulsy.
Karol P.
Karol P. 2023 年 3 月 6 日
And what in a case I want to process several ANNs in loop (some kind of automatization)? In this case I can't run command by command.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by