octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #42832] signal package: findpeaks: operator -:


From: Andreas Weber
Subject: [Octave-bug-tracker] [bug #42832] signal package: findpeaks: operator -: nonconformant arguments - when no peaks found
Date: Mon, 19 Jan 2015 18:12:19 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.3.0

Follow-up Comment #4, bug #42832 (project octave):

Mike, sorry for the late reply.

cset 56e2f21ec883 fixed the "error: findpeaks: operator -: nonconformant
arguments (op1 is 0x1, op2 is 1x0)" when using a column vector with no max or
min (ones (6, 1)) for me. The reason is:


octave:> ones (0, 1) - ones (1, 0)
error: operator -: nonconformant arguments (op1 is 0x1, op2 is 1x0)


but with bsxfun:


octave:> bsxfun (@minus, ones (0, 1), ones (1, 0))
ans = [](0x0)


The other problem is, if DATA is a row vector despite the help text
explicitely says: "DATA is expected to be a single column vector"

I think we should issue an error in this case:

diff -r 0393301722df inst/findpeaks.m
--- a/inst/findpeaks.m  Sun Jan 11 11:46:59 2015 -0500
+++ b/inst/findpeaks.m  Mon Jan 19 19:09:29 2015 +0100
@@ -133,6 +133,11 @@
            'Data contains negative values. You may want to "DoubleSided"
option
   endif
 
+  if (! iscolumn (data))
+    error ("findpeaks:InvalidArgument",
+           "DATA is expected to be a single column vector");
+  endif
+
   ## Rough estimates of first and second derivative
   df1 = diff (data, 1)([1; (1:end)']);
   df2 = diff (data, 2)([1; 1; (1:end)']);


Thank you, Andy

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42832>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]