필터 지우기
필터 지우기

Attempt to execute SCRIPT ' ' as a function error

조회 수: 13 (최근 30일)
Elle Kay
Elle Kay 2024년 2월 14일
답변: Walter Roberson 2024년 2월 14일
Hi,
I am running custom code that has worked fine for a couple of years and I'm suddenly running into the following error:
Attempt to execute SCRIPT graphics/private/adjustGridLineStyles as a function
The function above is a Matlab function, and I have nothing that shares its name.
Prior to this, I had an identical error with two other Matlab functions including the following:
Attempt to execute SCRIPT internal.stats.strCollapse as a function
So I don't think it's my code. I am on a new computer but I have it set up like the old one and I've reset paths to default. Any ideas would be helpful.
Thank you.
  댓글 수: 3
Elle Kay
Elle Kay 2024년 2월 14일
1) It's a Matlab script, not my own
2) it is invoked 4, 5 functions into a call from my own script
3) it is not specific to that script; everytime I restart Matlab, a different script gets flagged into the same error. For instance, here is the full error relating to the strCollapse.m script:
Error using internal.stats.strCollapse
Attempt to execute SCRIPT strCollapse as a function:
/Applications/MATLAB2014b/MATLAB2014b/MATLAB_R2014b.app/toolbox/stats/stats/+internal/+stats/strCollapse.m
Error in classreg.regr.FormulaProcessor>terms2expr (line 777)
termNames{k} = internal.stats.strCollapse(varNames(ij),'*');
Error in classreg.regr.FormulaProcessor/getStr (line 519)
str = composeFormulaString(f.link,f.responseName,terms2expr(f.terms,f.varNames));
Error in classreg.regr.FormulaProcessor/processFormula (line 595)
f.str = getStr(f);
Error in classreg.regr.FormulaProcessor (line 390)
f = processFormula(f,varNames);
Error in classreg.regr.LinearFormula (line 48)
f = f@classreg.regr.FormulaProcessor(varargin{:});
Error in classreg.regr.LinearMixedFormula/processFormula (line 305)
f.FELinearFormula = classreg.regr.LinearFormula(FELinearFormulaStr,varNames);
Error in classreg.regr.LinearMixedFormula (line 184)
f = processFormula(f,varNames);
Error in GeneralizedLinearMixedModel.fit (line 2180)
model.Formula = classreg.regr.LinearMixedFormula(formula,ds.Properties.VariableNames);
Error in fitglme (line 389)
glme = GeneralizedLinearMixedModel.fit(T,formula,varargin{:});
Error in behavioralOLD_20240213 (line 341)
lm1 = fitglme(allMatT, 'choices ~ target * EP1 + target * Risk1 + Gender + (target|subject)', 'Distribution',
'Binomial', 'BinomialSize', ones(height(allMatT),1), 'Link', 'logit');
Matt J
Matt J 2024년 2월 14일
I would do a clean reinstall (i.e., completely deleting all pre-existing Maltab installation folders).

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

답변 (1개)

Walter Roberson
Walter Roberson 2024년 2월 14일
This problem is caused by a corruption of the MATLAB installation, one that causes it to lose track of the internal implementation of functions. The search for the function instead finds the .m file that exists only for documentation purposes. Because the documentation .m has only comments, it is technically a script file.
There is a possibility that the system might fix itself if you do
restoredefaultpath; rehash toolboxcache
but it is common that when this sort of corruption occurs that you need to reinstall MATLAB.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by