From 49b5bb405a26fc84ed6476f32a3dca1bed982602 Mon Sep 17 00:00:00 2001 From: Yair Altman Date: Sun, 22 Mar 2020 14:21:20 +0200 Subject: [PATCH] Alert if ghostscript.m is required but not found on Matlab path --- print2array.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/print2array.m b/print2array.m index 287989b..9b98553 100644 --- a/print2array.m +++ b/print2array.m @@ -51,6 +51,7 @@ % 07/07/15: Fixed issue #83: use numeric handles in HG1 % 11/12/16: Fixed cropping issue reported by Harry D. % 29/09/18: Fixed issue #254: error in print2array>read_tif_img +% 22/03/20: Alert if ghostscript.m is required but not found on Matlab path %} % Generate default input arguments, if needed @@ -109,6 +110,10 @@ [A, err, ex] = read_tif_img(fig, res_str, renderer, tmp_nam); if err, rethrow(ex); end catch % error - try to print to EPS and then using Ghostscript to TIF + % Ensure that ghostscript() exists on the Matlab path + if ~exist('ghostscript','file') && isempty(which('ghostscript')) + error('export_fig:print2array:ghostscript', 'The ghostscript.m function is required by print2array.m. Install the complete export_fig package from https://www.mathworks.com/matlabcentral/fileexchange/23629-export_fig or https://github.com/altmany/export_fig') + end % Print to eps file if isTempDirOk tmp_eps = [tempname '.eps'];