From 32d5bc05a10363dbc7693b0bea784145ab32258e Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Wed, 4 Oct 2023 20:42:31 +0200 Subject: [PATCH] Octave: support ofig graph format --- doc/manual/source/the-model-file.rst | 4 ++-- matlab/dyn_saveas.m | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst index 062a62301..bd3d01db8 100644 --- a/doc/manual/source/the-model-file.rst +++ b/doc/manual/source/the-model-file.rst @@ -4499,8 +4499,8 @@ Computing the stochastic solution graph_format = ( FORMAT, FORMAT... ) Specify the file format(s) for graphs saved to disk. Possible - values are ``eps`` (the default), ``pdf``, ``fig`` and ``none`` - (under Octave, ``fig`` is unavailable). If the + values are ``eps`` (the default), ``pdf``, ``fig`` and ``none``. + Under Octave, ``fig`` will use Octave’s ``ofig`` format. If the file format is set equal to ``none``, the graphs are displayed but not saved to the disk. diff --git a/matlab/dyn_saveas.m b/matlab/dyn_saveas.m index a23fda6e6..7aa7518be 100644 --- a/matlab/dyn_saveas.m +++ b/matlab/dyn_saveas.m @@ -52,17 +52,12 @@ if any(strcmp('pdf',cellstr(graph_format))) print(h,'-dpdf',[fname,'.pdf']) end if any(strcmp('fig',cellstr(graph_format))) + if nodisplay + set(h,'CreateFcn','set(gcf, ''Visible'',''on'')') ; + end if isoctave - error('Octave cannot create fig files!') + saveas(h,[fname '.ofig']); else - if nodisplay - % THE FOLLOWING LINES COULD BE USED IF BUGS/PROBLEMS ARE REPORTED USING LINE 60 - % set(h,'Units','Normalized') - % mypos=get(h,'Position'); - % set(h,'Position',[-1 -1 mypos(3:4)]) - % set(h, 'Visible','on'); - set(h,'CreateFcn','set(gcf, ''Visible'',''on'')') ; - end saveas(h,[fname '.fig']); end end