From 3b0ce7619631ecdca8f8a595b3a73fe02b97e5d9 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Tue, 25 Oct 2016 23:53:01 -0400 Subject: matlab plots are done via pipe --- matlab_eps.mk | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/matlab_eps.mk b/matlab_eps.mk index 71e0f13..c184896 100644 --- a/matlab_eps.mk +++ b/matlab_eps.mk @@ -3,11 +3,17 @@ CLEAN_TARGETS += clean_matlab_eps_targets REAL_CLEAN_TARGETS += real_clean_matlab_eps_targets -MATLAB ?= matlab -nodesktop -nosplash -MATLAB_INITIATE_FIGURE = "h=figure('visible', 'off');" +# MATLAB ?= matlab -nodesktop -nosplash +# MATLAB_quit = quit +MATLAB ?= cmd2screen.sh +MATLAB_quit ?= +MATLAB_CLEAR = "clear;" +MATLAB_STORE_OLDPWD = "oldpwd=pwd;" +MATLAB_RESTORE_OLDPWD = "cd(oldpwd);" +MATLAB_PWD = "cd '$(CURDIR)';" +MATLAB_INITIATE_FIGURE = "h=figure('visible', 'off'); clf;" MATLAB_EPS_PRINT_strt = print('-depsc', MATLAB_EPS_PRINT_stop = ); -MATLAB_quit = quit matlab_sources = $(wildcard plot_*.m) @@ -19,9 +25,14 @@ copy_matlab_pdf_targets: dest_dir_matlab $(matlab_pdf_targets) $(matlab_eps_targets): %.eps : plot_%.m tmp=`mktemp`; \ - echo $(MATLAB_INITIATE_FIGURE) > $${tmp}; \ + touch $${tmp}; \ + echo $(MATLAB_CLEAR) >> $${tmp}; \ + echo $(MATLAB_STORE_OLDPWD) >> $${tmp}; \ + echo $(MATLAB_PWD) >> $${tmp}; \ + echo $(MATLAB_INITIATE_FIGURE) >> $${tmp}; \ cat $< >> $${tmp}; \ echo "$(MATLAB_EPS_PRINT_strt)'$@'$(MATLAB_EPS_PRINT_stop)" >> $${tmp}; \ + echo $(MATLAB_RESTORE_OLDPWD) >> $${tmp}; \ echo "$(MATLAB_quit)" >> $${tmp}; \ cat $${tmp} | $(MATLAB); \ rm -f $${tmp} -- cgit v1.2.3