>>firstName = 'Bob';
>> lastName = 'Jones';
>> fullName = [firstName, ' P . ', lastName]
>>strVect = char('seven', 'of')
seven
of
Others:
>> z = repmat([1 5 7 9], 3, 1) or >> z = repmat(10.1, 2, 5)
z =
1 5 7 9
1 5 7 9
1 5 7 9
>> any(data(:, 1) == 2)
ans =
1
all(data(:, 1) == 2)
ans =
0
>>all(data(:, 1) >= 1 & data(:, 1) <>
intersect function as an enhanced find function. Where find can only compare one column of data, intersect can compare multiple columns of data.
>> cols = [1 1 1; 1 1 3; 1 1 2; 1 1 5; 1 1 5; 1 1 3]
>> [a rows] = intersect(cols, [1 1 2], 'rows')
a =
1 1 2
rows =
3
No comments:
Post a Comment