Matlab engine through C++ - Avoid the opening of the graph

1 回表示 (過去 30 日間)
Flo
Flo 2016 年 5 月 5 日
コメント済み: Flo 2016 年 5 月 6 日
Hi everyone,
I am using matlabe engine through my C++ code. my code is very simple and each time I run it it opens the graph from matlab, before saving it in a folder. Is there a way of telling matlab to not open the graph when it creates it ?
here is my matlab code
h(:,1)=one;
h(:,2)=two;
[y,x]=hist(h);
%NumBins = 10;
bar(x,y, 'group');
title('Area comparison');
xlabel('Area'); % x-axis label
ylabel('Frequency'); % y-axis label
%may do it as two variables passed through C++
legend('XZ','YZ');
saveas(gcf,mypath);
one, two, and mypath are variables given through C++. cheers, Flo

採用された回答

James Tursa
James Tursa 2016 年 5 月 5 日
編集済み: James Tursa 2016 年 5 月 5 日
Prior to calling the hist function, create the figure with the 'Visible' property set to 'Off'. E.g.,
f = figure('Visible','Off');
[y,x] = hist(h);
:
etc
If you subsequently want to see the plot, you can do this:
set(f,'Visible','On');
If you never want to see the plot with this code, then you don't need to save the gcf in the f variable.
  1 件のコメント
Flo
Flo 2016 年 5 月 6 日
Thank you very much !

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by