Diff of /inst/ricedeco.m [e9066d] .. [b37be7]  Maximize  Restore

  Switch to side-by-side view

--- a/inst/ricedeco.m
+++ b/inst/ricedeco.m
@@ -51,32 +51,32 @@
 ##endfor
 ##
 
-function sig_op=ricedeco(code,K)
+function sig_op = ricedeco (code, K)
 
-  if ( nargin < 2 ) || (strcmp(class(code),"cell")~=1)
+  if (nargin < 2) || (strcmp (class (code), "cell") ~= 1)
     print_usage ();
   endif
 
-  L=length(code);
+  L = length (code);
 
-  K_pow_2=2**K;
+  K_pow_2 = 2**K;
 
-  if(K ~= 0)
-    power_seq=[2.^((K-1):-1:0)];
-    for j=1:L
-      word=code{j};
-      idx=find(word==0)(1);
-      val=sum(word(1:idx));
-      sig_op(j)=val*K_pow_2 + sum(word(idx+1:end).*power_seq);
+  if (K ~= 0)
+    power_seq = [2.^((K-1):-1:0)];
+    for j = 1:L
+      word = code{j};
+      idx = find (word == 0)(1);
+      val = sum (word(1:idx));
+      sig_op(j) = val * K_pow_2 + sum (word(idx+1:end) .* power_seq);
     endfor
   else
-    for j=1:L
-      sig_op(j)=sum(code{j});
+    for j = 1:L
+      sig_op(j) = sum (code{j});
     endfor
   endif
 
 endfunction
 
 %!
-%! assert(ricedeco(riceenco(1:4,2),2),[1:4])
+%!assert (ricedeco (riceenco (1:4, 2), 2), [1:4])
 %!

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks