From fb336114c97e8cc4ee0ce1851cb37b138b9b2a23 Mon Sep 17 00:00:00 2001 From: David Stanley Date: Tue, 11 Apr 2017 19:17:39 -0400 Subject: [PATCH] iss #007 xp_plotimage.m now can handle missing files without crashing. --- library_plots/xp_plotimage.m | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/library_plots/xp_plotimage.m b/library_plots/xp_plotimage.m index e19bf2e..13b337a 100644 --- a/library_plots/xp_plotimage.m +++ b/library_plots/xp_plotimage.m @@ -16,16 +16,21 @@ if ~isempty(xp.data{1}) if iscellstr(xp.data{1}) - rgb = imread(xp.data{1}{op.saved_fignum}); + currfile = xp.data{1}{op.saved_fignum}; elseif ischar(xp.data{1}) - rgb = imread(xp.data{1}); + currfile = xp.data{1}; end + + if exist(currfile,'file') + rgb = imread(currfile); + + if ~isempty(op.scale) + rgb = imresize(rgb,op.scale); + end - if ~isempty(op.scale) - rgb = imresize(rgb,op.scale); + hxp.hcurr = imshow(rgb); end - - hxp.hcurr = imshow(rgb); + end end