diff scripts/control/system/abcddim.m @ 7136:59dcf01bb3e3

[project @ 2007-11-08 20:18:25 by jwe]
author jwe
date Thu, 08 Nov 2007 20:18:26 +0000
parents a1dbe9d80eee
children
line wrap: on
line diff
--- a/scripts/control/system/abcddim.m
+++ b/scripts/control/system/abcddim.m
@@ -68,7 +68,7 @@
 function [n, m, p] = abcddim (a, b, c, d)
 
   if (nargin != 4)
-    error ("abcddim: four arguments required");
+    print_usage ();
   endif
 
   n = m = p = -1;
@@ -78,52 +78,53 @@
   [c, cn, cm] = __abcddims__ (c);
   [d, dn, dm] = __abcddims__ (d);
 
-  if ( (!issquare(a)) & (!isempty(a)) )
-    warning (["abcddim: a is not square (",num2str(an),"x",num2str(am),")"]);
-    return
+  if (! issquare (a) && ! isempty (a))
+    warning ("abcddim: a is not square (%dx%d)", an, am);
+    return;
   endif
 
-  if( (bm == 0) & (dm == 0) )
-    warning("abcddim: no inputs");
+  if (bm == 0 && dm == 0)
+    warning ("abcddim: no inputs");
   elseif (bn != am)
-    warning (["abcddim: a(",num2str(an),"x",num2str(am), ...
-      " and b(",num2str(bn),"x",num2str(bm),") are not compatible"]);
-    return
+    warning ("abcddim: a(%dx%d) and b(%dx%d) are not compatible",
+	     an, am, bn, bm);
+    return;
   endif
 
-  if( (cn == 0) & (dn == 0 ) )
-    warning("abcddim: no outputs");
+  if (cn == 0 && dn == 0)
+    warning ("abcddim: no outputs");
   elseif (cm != an)
-    warning (["abcddim: a(",num2str(an),"x",num2str(am), ...
-        " and c(",num2str(cn),"x",num2str(cm),") are not compatible"]);
-    return
+    warning ("abcddim: a(%dx%d) and c(%dx%d) are not compatible",
+	     an, am, cn, cm);
+    return;
   endif
 
   have_connections = (bn*cn != 0);
 
-  if( (dn == 0) & have_connections)
-    warning("abcddim: empty d matrix passed; setting compatibly with b, c");
+  if (dn == 0 && have_connections)
+    warning ("abcddim: empty d matrix passed; setting compatibly with b, c");
     [d, dn, dm] = __abcddims__ (zeros (cn, bm));
   endif
 
-  if(an > 0)
-    [dn, dm] = size(d);
-    if ( (cn != dn) & have_connections )
-      warning (["abcddim: c(",num2str(cn),"x",num2str(cm), ...
-        " and d(",num2str(dn),"x",num2str(dm),") are not compatible"]);
-      return
+  if (an > 0)
+    [dn, dm] = size (d);
+    if (cn != dn && have_connections)
+      warning ("abcddim: c(%dx%d) and d(%dx%d) are not compatible",
+	       cn, cm, dn, dm);
+      return;
     endif
 
-    if ( (bm != dm) & have_connections )
-      warning (["abcddim: b(",num2str(bn),"x",num2str(bm), ...
-          " and d(",num2str(dn),"x",num2str(dm),") are not compatible"]);
-      return
+    if (bm != dm && have_connections)
+      warning ("abcddim: b(",num2str(bn),"x",num2str(bm), ...
+          " and d(",num2str(dn),"x",num2str(dm),") are not compatible");
+      return;
     endif
 
     m = bm;
     p = cn;
   else
-    [p,m] = size(d);
+    [p, m] = size (d);
   endif
   n = an;
+
 endfunction