[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #47951] find complex number array elements wit
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #47951] find complex number array elements with condition |
Date: |
Wed, 18 May 2016 03:03:33 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/45.0.2454.101 Chrome/45.0.2454.101 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?47951>
Summary: find complex number array elements with condition
Project: GNU Octave
Submitted by: None
Submitted on: 2016년 05월 18일 (수) 오전 03시 03분 30초
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email: address@hidden
Open/Closed: Open
Discussion Lock: Any
Release: 4.0.2
Operating System: GNU/Linux
_______________________________________________________
Details:
Hi,
Finding elements with a condition from an array with complex numbers works
differently between matlab and octave.
Here's an example
$ cat a.m
arr = [1, 2+1i, 3, 0, -1, -2]
arr(find(arr>0))
$ octave-cli a.m
arr =
1 + 0i 2 + 1i 3 + 0i 0 + 0i -1 + 0i -2 + 0i
ans =
1 + 0i 2 + 1i 3 + 0i -1 + 0i -2 + 0i
Octave returns all elements but 0.
However, matlab doesn't include last two items in the result. It only returns
1, 2+1i, 3.
The following code returns same result in both
arr = [1, 2+1i, 3, 0, -1, -2]
arr(find(real(arr)>0))
Regards,
Louis
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47951>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #47951] find complex number array elements with condition,
anonymous <=