matlab: deleting rows of a matrix given some index -


i have big matrix , want delete rows of indexes in vector v. vector unsorted code below won't work

for i=1:length(v)      a(v(i))=[] end 

the problem when example row 2 deleted, , next want delete row 4, delete row 5 instead, cause index of row 5 4. think possible sort v descending , delete above sorting time consuming. there other task?

you need pass entire vector of indices delete.

matlab supports powerful indexing features, , learning them simplify writing code , make them less error-prone.

sample code

% delete rows row indices in v a(v, :) = [] 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -