필터 지우기
필터 지우기

Why do I get the error "too many output arguments"?

조회 수: 16 (최근 30일)
Noya Linder
Noya Linder 2023년 6월 15일
댓글: Jon 2023년 6월 15일
I call this function:
function nvec = removeByGamma(tR)
t = tR(1);
R = tR(2);
line = linespace(1, length(R), 1);
for i = line
g = findGamma(R(i));
if (g>Gammaf)
R(i) = [];
t(i) = [];
end
end
nvec = [t, R];
end
here
[t, R] = removeByGamma(ode45(@odefun, tspan, r0));
yet I get the error:
Error using solve>removeByGamma
Too many output arguments.
Error in solve (line 26)
[t, R] = removeByGamma(ode45(@odefun, tspan, r0));
I'm a bit new to this and I have no idea what's the problem
Thank you in advance!

채택된 답변

Jon
Jon 2023년 6월 15일
You have defined your function removeByGamma with only one output argument
function nvec = removeByGamma(tR)
but then you call it with two output arguments, t and R:
[t, R] = removeByGamma(ode45(@odefun, tspan, r0));
MATLAB is telling you it has no way of knowing how to assign that second argument
  댓글 수: 3
Noya Linder
Noya Linder 2023년 6월 15일
Thank you so much! have a great day :)
Jon
Jon 2023년 6월 15일
Your welcome!

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by