Effacer les filtres
Effacer les filtres

Can I write type converters for a custom class?

4 vues (au cours des 30 derniers jours)
Hau Kit Yong
Hau Kit Yong le 23 Avr 2019
I want to write a method in my custom classes to return string representations of instantiated objects (similar to writing a "__str__" method in Python), to allow calls such as sprintf('%s', object). The next best solution is to just write a "toString" method for each of my classes, but of course I would have to maintain that function name for all my classes to make the code usable. I appreciate any other ideas.

Réponses (0)

Catégories

En savoir plus sur Construct and Work with Object Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by