Monday, September 8, 2008

tips

You can also assign a scalar to all entries of a submatrix. Try:
A(:, [2 4]) = 99

You can delete rows or columns of a matrix by assigning the empty matrix ([]) to them. Try:
A(:, [2 4]) = []


>> x= rand(1,5)

x =

0.7513 0.2551 0.5060 0.6991 0.8909

>> x = x(end:-1:1)

x =

0.8909 0.6991 0.5060 0.2551 0.7513

No comments: