필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Calling script within method fails

조회 수: 2 (최근 30일)
Daniel H
Daniel H 2015년 3월 12일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi,
I have a method which calls an external script. Example.
../../script.m:
ret = 1000;
The method looks as follows:
methods
function value = CalculateEntry(this)
run('../../script.m');
value = ret;
end
end
However, I get
??? Error using ==> CalculateEntry
Output argument "value" (and maybe others) not assigned during call to
...
When I debug the program I see that script.m is executed and "ret" is assigned. However, when "run" returns to "CalculateEntry", "ret" is suddenly NaN.
How to fix this?
  댓글 수: 1
Guillaume
Guillaume 2015년 3월 12일
Why not convert the script into a function. It'll probably solve your problem and would be cleaner anyway as it's then clear what the inputs and outputs are

답변 (1개)

Daniel H
Daniel H 2015년 3월 12일
Indeed, I had a type (instead "ret" I used "I0" in my code but accidentially used "IO"...)

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by