Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Flo
Flo el 5 de Mayo de 2016
Comentada: Flo el 6 de Mayo de 2016
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

Respuesta aceptada

James Tursa
James Tursa el 5 de Mayo de 2016
Editada: James Tursa el 5 de Mayo de 2016
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.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by