مدرس المادة
The Colon Operator
The colon" : " is one of MATLAB’s most important operators. It occurs
in several different forms. The expression
>>1:10
is a row vector containing the integers from 1 to 10
1 2 3 4 5 6 7 8 9 10
To obtain nonunit spacing, specify an increment. For example,
>>100:-7:50
is
100 93 86 79 72 65 58 51
• End as a subscript
To access the last element of a matrix along a given dimension, use end
as a subscript. This allows you to go to the final element without knowing
in advance how big the matrix is. For example:
>> q = 4:10
q=
4 5 6 7 8 9 10
>> q(end)
ans = 10
>> q(end-4:end)
ans =
6 7 8 9 10
تحميل الملف