>> data = [1 2;
3 4]
>> data(1,2) % Get the cross of the 1st row and the 2nd column
2 % var(row, col)
>> data(end,end) % Get the end of row and column
4
>> data(1:2,1) % Get elements cross at rows 1 till 2 and col 1
1
3
>> data(1:2,1:2) % Get rows 1 till 2 and col 1 till 2
1 2 % var(r1:r2, c1:c2)
3 4 % r1:r2 = row1 till row2>> data(:,1) % Get all rows at col 1
1
3
1 2
>> data(:) % Get all elements in consecutive order
Detele rows or columns:
>> data(1,:) % Delete all elements at the first row
>> data(:,1) % Delete all elements at the first columnGenerating built in matric style:
>> zeros(r,c) % Creating zero matrix by r and c dimension
>> magic(d) % Creating random matrix by d and d dimension
>> ones(r,c) % Creating 1 matrix by r and c dimension
>> rand(r,c) % Creating random matrix by r and c dimension
>> randn(r,c) % Creating random matrix (negative included)
% by r and c dimension
>> eye(d) % Creating a diagonal matrix
mas ijin nyuwun backline kita sama sama untung klik di sini
ReplyDelete