changeset 443:12db86a8ec7b

Fix bug in spyh() when the matix has no non-zero elements.
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 19 Mar 2017 13:39:49 +0100
parents 0ef8965dd745
children 3f236a83d8ad 236744dda401
files spyh.m
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
diff -r 0ef8965dd745 -r 12db86a8ec7b spyh.m
--- a/spyh.m	Mon Mar 13 14:40:14 2017 +0100
+++ b/spyh.m	Sun Mar 19 13:39:49 2017 +0100
@@ -3,10 +3,14 @@
     [n,m] = size(A);
     [I,J] = find(A);
 
-    h = plot(J,I);
-    h.LineStyle = 'none';
-    h.Marker = '.';
-    h.MarkerSize = 14;
+    if ~isempty(J)
+        h = plot(J,I);
+        h.LineStyle = 'none';
+        h.Marker = '.';
+        h.MarkerSize = 14;
+    else
+        h = [];
+    end
 
     a = gca;
     xlim([0 m+1]);