Using if statement inside a function,I didn't understand why the error is coming,why I am unable to use the values of x & y inside the if loop
이전 댓글 표시
function O = help(~,~)
i=input('Value of i:');
j=input('Value of j:');
O = y(i,j);
function g=y(x,y)
if(x==y)
{
k = rem(x,2);
s = log2( (y - k) );
g = 2^(-s);
}
else
{
g=0;
}
end
return;
end
return;
end
댓글 수: 2
Walter Roberson
2013년 3월 11일
There is no such thing as an "if loop". The body of an "if" is executed exactly once (or not at all), whereas a "loop" would continue executing the body until some condition was met.
Jan
2013년 3월 11일
Please post the error message.
Be sure not to shadow the important Matlab function help by your function. This would be a very bad idea.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!