MATLAB: How to reverse the case of a selected string

reverse the case of a selected string

vERY OFTEN i FIND THAT i ACCIDENTLY HAVE THE CAPS LOCK ON.
iS THERE ANY WAY TO EASILY REVERSE THE CASE OF A SELECTED STRING?
i'VE FINALLY REACHED THE LIMIT OF MY PATIENCE W.R.T. THIS.
tia
gREG

Best Answer

Wrap in a function...
>> s='gREG';
>> ilo=lower(s)==s;
>> s(iup)=lower(s(iup));
>> s(ilo)=upper(s(ilo));
>> s
s =
Greg
>>
Can be done w/ arrayfun and anonymous function on the fly, too...
ADDENDUM
Thought I had completed my thoughts but see I hadn't...
I presume, however, you're looking for this in the editor and there I have yet to figure out how one can extend it or bind a key to a m-file or the like. One can change key bindings to defined actions albeit it's a klunky interface to find them but afaict there's no extensibility.
It's why for coding "in anger" I don't use the Matlab editor but one of long personal familiarity.
If there is a way to customize the builtin editor, I'd surely like to know how and where it is documented, too....
Related Question