Function definitions are not permitted in this context.

조회 수: 1 (최근 30일)
Azam Rashdi
Azam Rashdi 2016년 4월 27일
댓글: Image Analyst 2016년 4월 27일
I am having this error "Function definitions are not permitted in this context." writing this
A = spdiags([-1 a11 0;ones(n-2,1)*[-1 2 -1];0 a11 -1],-1:1,n,n)'/h^2;

채택된 답변

Image Analyst
Image Analyst 2016년 4월 27일
You have probably combined a function and a script in the same m-file. You can't do that. If your script is called test.m, and has MyFunction defined in it some where, then make sure this is the first line of your test.m
function test()
  댓글 수: 2
Azam Rashdi
Azam Rashdi 2016년 4월 27일
Thanks Image I manage to get rid of that now having another problem,
tf = dt*nt; % final time
Not enough input arguments.
Error in navierstokes (line 4) tf = dt*nt; % final time
can you help in this regards
Image Analyst
Image Analyst 2016년 4월 27일
You forgot to paste the actual error message. Maybe you want dt.*nt - I have no idea.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by