Random "Function definitions are not permitted in this context." When running integral

Hi,
My Matlab refuses to run the "Intgeral" function. When I run this piece of code, I get a weird error:
>> integral(@(z) z.^2, 0,1)
Error: File: integralCalc.m Line: 1 Column: 2
Function definitions are not permitted in this context.
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
It doesn't happen if I use integral2 in the same context:
>> integral2(@(z,t) z.^2, 0,1,0,1)
ans =
0.3333
Clear workspace doesn't change anything, so as restarting Matlab.
This didn't happen before, and I just started happening one day.
Thanks, Yotam

回答 (1 件)

Jos (10584)
Jos (10584) 2016 年 6 月 14 日

0 投票

It does not happen to me. Did you perhaps overwrite the integralCalc.m file? It should start with the word function.

2 件のコメント

Yotam Vaknin
Yotam Vaknin 2016 年 6 月 14 日
Hi Jos,
Where should I look for this file? thanks, Yotam
Please show the output of
which integral
which integralCalc

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeVariables についてさらに検索

製品

質問済み:

2016 年 6 月 14 日

コメント済み:

2016 年 6 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by