Skip to content

Commit

Permalink
Merge pull request #1672 from farhi/main
Browse files Browse the repository at this point in the history
tools/matlab: Octave use waitfor instead of pause.
  • Loading branch information
willend authored Aug 9, 2024
2 parents be98bf3 + 0932fd7 commit d8d77c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tools/matlab/mcdisplay/mcdisplay.in
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ shift $((OPTIND-1))
if [ "$RUN_MATLAB" == "1" ]; then
matlab -nosplash -nodesktop -r "addpath('${LIB}');${TOOL} ${MCRUN} $*"
elif [ "$RUN_OCTAVE" == "1" ]; then
octave --eval "addpath('${LIB}');${TOOL} ${MCRUN} $* ; disp('--> Right-click in axis for toggles etc.'); disp('Press a key to exit @P@display-matlab ...'); set(gcf,'closerequestfcn','exit'); pause"
octave --eval "addpath('${LIB}');${TOOL} ${MCRUN} $* ; disp('--> Right-click in axis for toggles etc.'); disp('Close window to exit @P@display-matlab ...'); set(gcf,'closerequestfcn','exit'); waitfor(gcf);"
else
echo ":: Failed to run Matlab/Octave ${TOOL}, trying default ${TOOL} instead."
echo ":: If this fails too, consider reinstalling ${TOOL}."
Expand Down
9 changes: 4 additions & 5 deletions tools/matlab/mcplot/mcplot.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
this_file = varargin{index};
if isempty(this_file) || (ischar(this_file) && isempty(dir(this_file))), continue; end
if isstruct(this_file),
this_data=mcplot_display(this_file);
this_data = mcplot_display(this_file);
elseif ischar(this_file),
this_data = mcplot(this_file);
else
Expand Down Expand Up @@ -142,9 +142,8 @@
if exist ('OCTAVE_VERSION', 'builtin')
if ~isempty(data)
if nargin==0 || nargin==1
display('Pausing --> Please press a key in the octave terminal exit.');
disp('Use the plot window')
pause();
display('Close window to exit the plot.');
waitfor(gcf);
end
end
end
Expand Down Expand Up @@ -736,7 +735,7 @@

% ==============================================================================

function data = mcplot_display(data, fig)
function [data, fig] = mcplot_display(data, fig)
% opens a new window, with subplots and plots each structure in axes
% data: single monitor structure or a cell array of monitor structures
% fig: optional figure handle to use, else a new figure is created.
Expand Down

0 comments on commit d8d77c9

Please sign in to comment.