[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a
From: |
Philip Nienhuis |
Subject: |
[Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space: |
Date: |
Fri, 9 Jun 2017 09:58:59 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 |
Follow-up Comment #9, bug #51187 (project octave):
OK I checked and it turns out that Matlab r2012a and r2016b behave differently
as regards char arrays. For simple character strings (1D vectors) the behavior
is as I wrote in comment #8:
R2016b
======
>> format compact
>> ismember ('b ', {'a ', 'b '})
ans =
logical
1
>> abc = ['a '; 'b '; 'c ']
abc =
a
b
c
>> ismember (abc, {abc})
ans =
3×1 logical array
0
0
0
>>
However with r2016b:
>> abc = ['a '; 'b '; 'c ']
abc =
a
b
c
>> ismember (abc, {abc}, 'legacy')
ans =
3×1 logical array
1
1
1
>>
R2012a
======
>> format compact
>> ismember ('b ', {'a ', 'b '})
ans =
1
>>
>> abc = ['a '; 'b '; 'c ']
abc =
a
b
c
>> ismember (abc, {abc})
ans =
1
1
1
>> ismember (abc, {'a '})
ans =
1
0
0
>> ismember (abc, {'a ', 'b '})
ans =
1
1
0
>> ismember (abc, {'a '; 'b '})
ans =
1
1
0
>> ismember (abc, {['a '; 'b '; 'c ']})
ans =
1
1
1
>>
The 'legacy' option seems to have been made especially for Tables and other
new stuff like datetime arrays, duration arrays and timetables; although it
existed already in r2012a where it apparently was meant to relax stricter
rules regarding input types.
I wonder if treatment of 2D char arrays in recent matlab releases might have
been an unintended "regression".
I didn't find info in Matlab's release notes, so I might enter a bug report
for it in the Mathworks site.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51187>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Dave Goel, 2017/06/06
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/06
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/06
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/06
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, John W. Eaton, 2017/06/06
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Guillaume, 2017/06/07
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/07
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Rik, 2017/06/08
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/09
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:,
Philip Nienhuis <=
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Rik, 2017/06/09
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/09
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Rik, 2017/06/09
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/10
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/13
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Rik, 2017/06/13
- [Octave-bug-tracker] [bug #51187] ISMEMBER fails if the string ends in a space:, Philip Nienhuis, 2017/06/14