Overload Char
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.
Cite As
Jon Danisch (2024). Overload Char (https://www.mathworks.com/matlabcentral/fileexchange/30194-overload-char), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
char_overload/
char_overload/@char/
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |