Overload Char

Changes default behavior of [], +, - for char types.
283 Downloads
Aktualisiert 26. Jan 2011

Lizenz anzeigen

This set of functions overloads horzcat([]), plus(+), and minus(-) for char types.

Using the builtin functions:
['a',98,'c'] -> 'abc'
'x'+1 -> 121
'x'-1 -> 119

Using the overloaded functions:
['a',98,'c'] -> 'a98c'
'x'+1 -> 'y'
'x'+ -1 -> 'w'
'x'-1 -> ''
'x'+'x' -> 'xx' %concatenate strings
'abc'-'b' -> 'ac' %removes token
'Hello World!' - 'World!' + 'Matlab!' -> 'Hello Matlab!'

To install, unzip somewhere and add the 'char_overloading' directory to your path. Do not add the '@char' directory to your path.
Installing does not enable this functionality until ToggleCharOverloading('on') is called.

Using ToggleCharOverloading from within functions does not work as intended. It is also written for Windows systems, but can be modified for Unix systems.

All functions are heavily documented, and lightly tested. It does not seem to break anything, but there is a possibility that something important may stop working or change its behavior.
Use at your own risk.

Zitieren als

Jon Danisch (2025). Overload Char (https://de.mathworks.com/matlabcentral/fileexchange/30194-overload-char), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2010b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Whos finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0