필터 지우기
필터 지우기

why two = for elseif

조회 수: 1 (최근 30일)
Tor Fredrik Hove
Tor Fredrik Hove 2011년 10월 15일
Why do one need two = for elseif here: http://bildr.no/view/1001050
I tried with only one and it does not work
Why does one not need two = here:
I have made the script work it is just I don't get why one need two = for the menu?

채택된 답변

Walter Roberson
Walter Roberson 2011년 10월 15일
In MATLAB, a single = is either direct assignment or a representation that assignment will happen (such as in a "for K=1:10" statement.)
In MATLAB, == is always comparison of values.
There are other comparison operators that include a single = as part of the token, such as <= . That must be read as a pair, not as "<" and "=" separately, just like "if" is not the same thing as "i f".
  댓글 수: 3
Jan
Jan 2011년 10월 15일
@Tor: a=b assigns the value of b to the variable a. a==b compares the values of a and b and replies TRUE, if they are equal, FALSE otherwise.
I strongly recommend to delete your comment, if you do not have the written consent of the author of the book. I assume posting a copy of the book conflicts with the copy right.
Walter Roberson
Walter Roberson 2011년 10월 15일
In most countries, posting of a limited section like that would be considered "fair use" or "fair dealings", as it is for the purpose of learning, analysis, and understanding.
The more that the posted section is trimmed down to the least amount required to make the point, the stronger the exemption or defense is.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by