필터 지우기
필터 지우기

how to clear this error?

조회 수: 3 (최근 30일)
PLACEIUS NISHIGA G
PLACEIUS NISHIGA G 2018년 1월 23일
답변: KSSV 2018년 1월 23일
Error: File: file.m Line: 103 Column: 1
Function definitions are not permitted in this context.
if true
103.function z = myfunction(Ns,8)
104.c = Ns;
105.d= 8;
106.z =f(c, d)
107.end
108.function z = f(c,d)
109. if ~mod(c,d)
110. z=0
111. else
112. z=d-mod(c,d);
113. end
114. end
115. end

채택된 답변

KSSV
KSSV 2018년 1월 23일
function z = myfunction(Ns)
c = Ns;
d= 8;
z =f(c, d) ;
end
function z = f(c,d)
if ~mod(c,d)
z=0
else
z=d-mod(c,d);
end
end
Save it.....it will be saved as myfunction.m. Call z = myfunction(3) ;

추가 답변 (1개)

카테고리

Help CenterFile Exchange에서 Files and Folders에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by