This seems like a bug in the 'categorical' class

if I define a cellstr:
>>n={'a','b','b','c'}
I can make it a categorical variable:
>> c=categorical(n)
c =
a b b c
and it will display correctly, but if one of the strings contains a parenthesis:
>> n={'a(','b','b','c'}
n =
'a(' 'b' 'b' 'c'
>> c=categorical(n)
c =
'a(' ' $1 ' ' $1 ' 'c'
The display after that element is showing some kind of pointer instead of the value.
There is also a problem with close-paren, but a little different.
>> n={'a)','b','b','c'}
n =
'a)' 'b' 'b' 'c'
>> c=categorical(n)
c =
a )' b ' b ' c '
Doesn't happen with [.
Clearly seems to be parse error in the display function for the class.
Anyway, thought you should know and wondering if there is a fix/workaround.
Thanks, Michael

 Respuesta aceptada

Peter Perkins
Peter Perkins el 13 de Mayo de 2015
Michael, thanks for reporting this. Not sure what version of MATLAB you're using, but this was fixed in R2014b:
>> categorical({'a(','b','b','c'})
ans =
a( b b c
>> categorical({'a)','b','b','c'})
ans =
a) b b c

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 7 de Mzo. de 2015

Comentada:

el 13 de Mayo de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by