string data type is not a class?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I would expect the following to pull up a list of methods for the string data type, but it does not:
methods("1")
Is there any rationale to this behavior?
1 comentario
Rik
el 14 de Jul. de 2021
s={string([])};cellfun('isempty',s),cellfun(@isempty,s)
This implies the isempty function is overloaded for strings (which is what the cellfun doc warns about for the legacy syntax), but this fact is not reflected in the values methods returns.
Why all these implementation details are hidden is a mystery to me.
Respuesta aceptada
Rik
el 14 de Jul. de 2021
help methods
This suggests that you can't use the methods(object) syntax for char and string inputs.
methods('1')
methods(class("1"))
7 comentarios
Steven Lord
el 15 de Jul. de 2021
There are a couple entries in the Release Notes related to the interaction between string arrays and the ismethod function, but I don't see any about string arrays and the methods function. I could have overlooked one, though, since searching the Release Notes for the word "method" or "methods" finds a lot of hits.
Rik
el 15 de Jul. de 2021
It makes sense to solve the ambiguity this way, but I still think it would merit a remark in the doc.
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!