>> tk
tk =
1 2 3
4 5 6
7 8 9
>> tk(1,:) //first row, all columns
ans =
1 2 3
>> tk(:,1) //first column, all rows
ans =
1
4
7
>> tk(1,1) //first row, first column
ans = 1
>> tk(1,2:3) //first row, second/third columns
ans =
2 3
>> tk(2:3,1) //2nd,3rd row, 1st column
ans =
4
7
>> tk(2:3) //If you omit column part, it's 1 by default. Also the result is in row format as opposed to the previous one
ans =
4 7
//flattening in row/column format
>> tk(:)
ans =
1
4
7
2
5
8
3
6
9
>> tk(:)'
ans =
1 4 7 2 5 8 3 6 9
No comments:
Post a Comment