Clear Filters
Clear Filters

Any way to use British spellings for function calls and arguments?

6 views (last 30 days)
This is really a very minor gripe, but the amount of times I'll be typing out several lines of code or several subplots and run into a wall of errors because of American spellings is pretty substantial (muscle memory takes over).
R accepts both the English and Americanised spellings of words. Is there any way I can have MATLAB accept the English (e.g. 'Grey', not 'Gray'; and 'Colour', not 'Color', etc.) spellings for functions and arguments?
Cheers! No problem if not, like I said as a Brit muscle memory tends to take over and I end up with an error.

Answers (3)

Adam
Adam on 25 Oct 2019
Edited: Adam on 25 Oct 2019
I took this seriously at first and was appalled! Not because I think it is 'wrong', but because I have taken advantage of Matlab's inability to spell correctly on numerous occasions by writing my own functions or variables with correctly spelled names like colourmap. Had this been implemented it would have caused all manner of clashes in my code.
But yeah, in case you didn't notice, check the date of the blog post!! I even read it on the day it came out and still didn't twig immediately!

Matt J
Matt J on 25 Oct 2019
You can certainly write your own function aliases, as for example,
function varargout=rgb2grey(varargin)
[varargout{1:nargout}]=rgb2gray(varargin{:});
end

Steven Lord
Steven Lord on 25 Oct 2019
Tab completion may be able to help you out, if you train your muscle memory to include the Tab key as part of your normal typing workflow. Typing "rgb2" then pressing Tab lists three possible completions; "rgb2g" [Tab] completes rgb2gray as that's an unambiguous completion. This works in the Command Window, the Editor, and the Live Editor.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!