본문 바로가기

elseif2

Using Matlab 'if Statement' | Assumption Statement Using Matlab 'if Statement' | Assumption Statement 'If statement' is confusing each time it is written because the rules vary depending on all programming languages. I'll leave you an example for the matlab, so if you don't remember, it'll be convenient to scratch it quickly and correct it. %% if-Statement Example Code if a == b display('a and b are same') elseif a > b display('a is bigger than .. 2020. 9. 24.
매트랩 if 문 사용하기 (가정문) 매트랩 if 문 사용하기 (가정문) if 문은 모든 프로그래밍 언어에 따라 규칙이 달라서 매번 쓸 때마다 헷갈린다. 예시로 남겨 놓을 테니 기억안날 때는 빠르게 긁어서 수정하면 편할 것이다. %% if-Statement Example Code if a == b display('a and b are same') elseif a > b display('a is bigger than b') else display('b is bigger than a') end 간단히 설명하자면 a와 b의 크기를 비교하여 문장을 표시해주는 코드이다. if가 시작한 후 elseif, esle 다 적고 마지막에 한 번만 end를 적으면 된다. elseif에서 띄어쓰기 안하게 조심하자. 결과는 a=1 b=2를 넣었을 때 다음과 같이 .. 2020. 8. 3.
반응형