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 Center および File ExchangeGet Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by