필터 지우기
필터 지우기

How to give an initial value to a variable in simulink "matlab function"

조회 수: 8 (최근 30일)
SHINCHEN
SHINCHEN 2014년 4월 1일
댓글: SHINCHEN 2014년 4월 5일
The input is "hitin" and the output is "hitout" (on the right-hand side of M function),which is saved as matrix HIT. However, I want to give an initial value to variable,"hitin". i uses "memory" but it has compiling error! If i am right the result of HIT is supposed to be 1 9 9 9 9 .... Hoping somebody can help me.

답변 (1개)

Niklas Nylén
Niklas Nylén 2014년 4월 1일
It looks like the reason for the compile error is that hitout may not be set at all, for example if hitin = -1.
Change the elseif condition to an else condition and the compile error should disappear.
  댓글 수: 3
Niklas Nylén
Niklas Nylén 2014년 4월 1일
Close Matlab, delete Kobetest_sfun.mexw64, start matlab and run again.
SHINCHEN
SHINCHEN 2014년 4월 5일
Sorry!I missed your answer. It is still not working. But thanks alot!

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by