From: fabio freschi on
Hi all,
I am running matlab in batch mode under linux via ssh (without X11 forwarding). The call statement is something like this:

matlab -nojvm <myscript.m> myout.txt &

This works fine and I am able to check the progress of my simulations by checking the txt file. The problem is that the script could have functions with graphical calls (e.g. h = figure; patch(...)) that are fine in interactive mode, but generates warnings when executed in batch mode.
I wonder whether it is possible to automatically suppress graphical calls or not.
Otherwise I wonder if it is possible to make a check on how matlab has been started and then suppress graphical output within my graphic function, i.e.

function h = mygraphicfunction(blabla)

if (matlab_started_with_graphic)
figure, plot(x,interesting_y)
else
fprintf('no graphic environment available\n')
end

Also other smarter solutions are welcome!
Thanks in advance
Fabio
From: Steven Lord on

"fabio freschi" <fabio.freschi(a)remove.gmail.com> wrote in message
news:hrotrj$5hm$1(a)fred.mathworks.com...
> Hi all,
> I am running matlab in batch mode under linux via ssh (without X11
> forwarding). The call statement is something like this:
>
> matlab -nojvm <myscript.m> myout.txt &
>
> This works fine and I am able to check the progress of my simulations by
> checking the txt file. The problem is that the script could have functions
> with graphical calls (e.g. h = figure; patch(...)) that are fine in
> interactive mode, but generates warnings when executed in batch mode.
> I wonder whether it is possible to automatically suppress graphical calls
> or not.

No, not as far as I'm aware, not without shadowing any and all graphics
functions you call. That could be painful and time consuming.

> Otherwise I wonder if it is possible to make a check on how matlab has
> been started and then suppress graphical output within my graphic
> function, i.e.

Use USEJAVA to determine if MATLAB has been started using the JVM; if it
hasn't, don't display the graphics.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: fabio freschi on
Fine, thanks a lot!
I will modify all my graphical functions!
Fabio
 | 
Pages: 1
Prev: header in matrix
Next: How to sort a 2-d matrix