% % Logical operators return 0 (false) or 1 (true) % This is bad programming practice but started with C coding % back in the 1970's and is embedded in much of numerical % computing! % % % For A321 course % % Last Modified: Mon 04 Feb 2008, 09:05 AM % % Get a simple vector to work with a = 1:9 a > 4 a < 4 a >= 4 a <= 4 % The next is a test for where a is equal to 4, not to be confused % with the assignment statement % a = 4 % which would reset the 1 x 9 vector a to be the 1 x 1 scalar value 4 a == 4 a ~= 4 % The inequality operator ~= can take the forms % != % /= % ^= % .ne. % in other languages, so it's one to check on in each case. % The others are standard in C, C++, Fortran, Perl, Python, ....