How to stop this error from occurring every time I try to open a function or script in matlab?
25 views (last 30 days)
Show older comments
I have a script that I am trying to open in matlab (just open, not run) and MATLAB gives me an error when I attempt to open the file. The only way I have been able to resolve this so far is by deleting matlab from my mac and reinstalling it but that is getting annoying. It happens randomly as far as I can tell and it currently happens whenever I try to open any matlab files. The file name is resSimProj.m This is the error I get every time I try to open it:
Error: File: unique.m Line: 1 Column: 1
Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.
Error in setdiff>setdiffR2012a (line 226)
c = unique(c,order);
Error in setdiff (line 111)
[varargout{1:nlhs}] = setdiffR2012a(varargin{:});
Error in matlab.internal.lang.capability.Capability.Unsupported (line 74)
list = setdiff(capabilityArray, current);
Error in matlab.internal.lang.capability.Capability.require (line 85)
missingRequirements = matlab.internal.lang.capability.Capability.Unsupported(capabilityArray);
Error in uiopen (line 58)
Capability.require(Capability.Swing);
1 Comment
Dyuman Joshi
on 1 Nov 2023
Edited: Dyuman Joshi
on 1 Nov 2023
I have bolded an important part of the problem description.
Seems like something is corrupted, given that you encounter the error on just opening the file.
However, that should be cleared when you re-install MATLAB completely. But, it still reoccurs. Weird.
Could you share the file that you are trying to open i.e. resSimProj.m ?
Answers (1)
Les Beckham
on 1 Nov 2023
Please enter the following command in the Command Window and make sure that the output looks similar to that shown here (all of the results are in subfolders of .../MATLAB/toolbox or ...\MATLAB\...). If you see any that aren't part of the Matlab installation, rename to something other than unique.m.
which -all unique
4 Comments
Steven Lord
on 1 Nov 2023
Also can you show the output of these commands?
dbtype 1 unique.m
L = readlines("unique.m");
D = double(char(L(1)))
I'm guessing you may have accidentally typed something as the first character in unique.m in which case the first number in the vector D will be different than 102 (the character 'f' in 'function').
Dyuman Joshi
on 1 Nov 2023
Shouldn't the file open without any errors?
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!