if else 함수보다 효율적인 솔루션에 대한 아이디어가 있습니까? 이것은 코드의 많은 부분을 차지하므로이를 줄여야합니다.else if 문을보다 효율적으로 만들 수 있습니까?
전체 기능은 그것을 만 확인할 수 있습니다 이런 식으로함으로써
function result = vre(t,r,e,n,d)
if (e==4 && r>0)
result = 0;
elseif (e==4 && r==0)
result = 1;
elseif (e<4 && r==1)
result = t;
elseif (e<4 && r==2)
result = d;
else
result=n;
end
end
switch 문을 고려 했습니까? http://www.mathworks.com/help/matlab/matlab_oop/functions-used-with-objects.html –