Error: Function definition not supported in this context. Create functions in code file.

Hello everyone,
i was traying to wirte a function and i receive every time i tray to call the function this message:
Error: Function definition not supported in this context. Create functions in code file.
i thougt i maybe have some syntax-problems, so i tried wtih this very simple function:
function [x,y] = solo(a,b,c,d)
x= (a*b)+c;
y= (a*d)+b;
end
i also wrote the function in seperate skript, saved it in a file with the same name(solo)
and always call it from the command window as i should do.
i still get this annoying message!! ERROR!!
i have MATLAB R2020b
please help!
thank u very much in advance

 채택된 답변

Jan
Jan 2021년 3월 22일
편집: Jan 2021년 3월 22일
How do you call this function? This would be working:
[x,y] = solo(a,b,c,d)
Do you include a "function" in this call?

댓글 수: 3

ah in this way it is working now thank u very much.
but why it does not work when i call it in the other way like:
function solo (1,2,3,4)
when i make this i get that error
The keyword "function" is the command to define a function, not to call it.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

질문:

2021년 3월 22일

댓글:

2021년 3월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by