필터 지우기
필터 지우기

How to stop this error from occurring every time I try to open a function or script in matlab?

조회 수: 21 (최근 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
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
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
/MATLAB/toolbox/matlab/ops/unique.m /MATLAB/toolbox/matlab/ops/@cell/unique.m % cell method /MATLAB/toolbox/matlab/datatypes/categorical/@categorical/unique.m % categorical method /MATLAB/toolbox/matlab/datatypes/tabular/@tabular/unique.m % tabular method /MATLAB/toolbox/matlab/datatypes/datetime/@datetime/unique.m % datetime method /MATLAB/toolbox/matlab/datatypes/duration/@duration/unique.m % duration method /MATLAB/toolbox/matlab/bigdata/@tall/unique.m % tall method /MATLAB/toolbox/matlab/datatypes/calendarDuration/@calendarDuration/unique.m % calendarDuration method /MATLAB/toolbox/parallel/gpu/@gpuArray/unique.m % gpuArray method /MATLAB/toolbox/parallel/parallel/@codistributed/unique.m % codistributed method /MATLAB/toolbox/shared/statslib/@dataset/unique.m % dataset method /MATLAB/toolbox/symbolic/symbolic/@sym/unique.m % sym method /MATLAB/toolbox/symbolic/symbolic/@symfun/unique.m % symfun method
  댓글 수: 4
Steven Lord
Steven Lord 2023년 11월 1일
Also can you show the output of these commands?
dbtype 1 unique.m
1 function varargout = unique(tA, varargin)
L = readlines("unique.m");
D = double(char(L(1)))
D = 1×37
102 117 110 99 116 105 111 110 32 118 97 114 97 114 103 111 117 116 32 61 32 117 110 105 113 117 101 40 118 97
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
Dyuman Joshi 2023년 11월 1일
@Steven Lord, But how will modifying unique.m result in an error when opening the file?
Shouldn't the file open without any errors?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by