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

조회 수: 3 (최근 30일)
Rowan Lawrence
Rowan Lawrence 2019년 10월 25일
답변: Steven Lord 2019년 10월 25일
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.

답변 (3개)

Adam
Adam 2019년 10월 25일
편집: Adam 2019년 10월 25일
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 2019년 10월 25일
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 2019년 10월 25일
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.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by