SUNY Geneseo Department of Mathematics
Monday, September 15
Math 230 01
Fall 2014
Prof. Doug Baldwin
clc
is (probably) safe in a diary. Like many points
about programming, this is a good one to just try it and see,
using a diary you don’t care about.any
, all
ask if any or all elements
of vector or matrix are trueisequal
asks if two whole matrices equal, considering dimensionsm1 = [1 2 3; 4 5 6]
m1 =
1 2 3
4 5 6
m2 = m1'
m2 =
1 4
2 5
3 6
m1 == m2
{Error using ==
Matrix dimensions must agree.
}
isequal( m1, m2 )
ans =
0
sum
to count number of places comparison holdsv1 = [1 2 3 4 5]
v1 =
1 2 3 4 5
v1 > 2.5
ans =
0 0 1 1 1
sum( v1 > 2.5 )
ans =
3
i = v1 > 2.5
i =
0 0 1 1 1
v1( i )
ans =
3 4 5
v1
v1 =
1 2 3 4 5