Matlab engine through C++ - Avoid the opening of the graph
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!