Azzera filtri
Azzera filtri

Attempt to execute SCRIPT ' ' as a function error

13 visualizzazioni (ultimi 30 giorni)
Elle Kay
Elle Kay il 14 Feb 2024
Risposto: Walter Roberson il 14 Feb 2024
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 Commenti
Elle Kay
Elle Kay il 14 Feb 2024
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 il 14 Feb 2024
I would do a clean reinstall (i.e., completely deleting all pre-existing Maltab installation folders).

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 14 Feb 2024
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.

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by