diff --git a/matlab/get_minimal_state_representation.m b/matlab/get_minimal_state_representation.m
index 3882c49dc878b2855b2fa28fe661aee761e4e36a..4b68bfceefdf20689f5df7517cdf9bcf9d43bdc3 100644
--- a/matlab/get_minimal_state_representation.m
+++ b/matlab/get_minimal_state_representation.m
@@ -117,6 +117,10 @@ else
                 end
                 minSYS.dD = SYS.dD;
             end
+        else
+            minSYS = []; 
+            minns = [];
+            return;
         end
     catch
         minreal_flag = 0; % if something went wrong use below procedure