Why doesn't Matlab call the overloaded subsref method?

12 vues (au cours des 30 derniers jours)
Patrick Mboma
Patrick Mboma le 6 Fév 2023
Commenté : Captain Karnage le 26 Juin 2023
Hi,
I have a class in which I have overloaded both subsref (and subasgn)
for some constructed object obj, I am able to sucessfully do the following :
  • obj(1)
  • obj{1}
  • obj('some string')
But I am not able to do
  • obj{'some string'}
In this particular case, when I call subsref with curly braces around a string, Matlab does not call the overloaded subsref. The error message I get is "Too many output arguments."
I don't understand what is going on
  1 commentaire
Captain Karnage
Captain Karnage le 26 Juin 2023
My best guess is that it's likely there's an error in your case '{}' that is creating an output for every char character. In order for someone to actually figure it out, however, you'd have to provide your subsref code.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Customize Object Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by