cspell-dicts
cspell-dicts copied to clipboard
Add MATLAB dictionary
It would be nice to include a dictionary for MATLAB.
Here is a file that lists all MATLAB functions and classes from my system that could be used:
matlab.txt
It has some entries, such as which, that are redundant.
This list is generated using the following script, based on this StackOverflow answer:
% Generate a list of all directories searched by MATLAB:
pathlist = strsplit(path,pathsep);
% Get functions and classes on search path
functions = {};
classes = {};
for p = pathlist
w = what(p{1});
functions = [functions; ...
erase(w.m,'.m'); ... % M-files
erase(w.mex,['.',mexext]); ... % MEX-files
erase(w.p,'.p')]; % and P-files are all functions
classes = [classes; w.classes]; % here are all classes
% TODO: w.packages gives package directory names, examine those too!
end
% Remove duplicates
functions = unique(functions);
classes = unique(classes);
file_id = fopen('C:\Users\pwintz\AppData\Roaming\Code\User\cspell-dictionaries\matlab.txt', 'w');
fprintf(file_id, '%s\n', functions{:}, classes{:});
% classes
@pwintz,
Would you be willing to create a dictionary? The instructions are here: How to Create a New Dictionary.