I have a vector with 100 elements. I have another vector with index positions of elements I want to remove from this vector.
How do I do this?
The easiest way to remove a row or column from a matrix is to set that row or column equal to a pair of empty square brackets [] . For example, create a 4-by-4 matrix and remove the second row. Now remove the third column.
Click a point that you want to exclude in the fit plot or residuals plot. Alternatively, click and drag to define a rectangle and remove all enclosed points.
To access elements in a range of rows or columns, use the colon . For example, access the elements in the first through third row and the second through fourth column of A . An alternative way to compute r is to use the keyword end to specify the second column through the last column.
vector(indecies) = []
example:
>> a = 1:10; >> a([3,4,7]) = [] a = 1 2 5 6 8 9 10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With