How to stop this error from occurring every time I try to open a function or script in matlab?
25 次查看(过去 30 天)
显示 更早的评论
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 个评论
Dyuman Joshi
2023-11-1
编辑:Dyuman Joshi
2023-11-1
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 ?
回答(1 个)
Les Beckham
2023-11-1
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 个评论
Steven Lord
2023-11-1
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
2023-11-1
Shouldn't the file open without any errors?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!