matlab - Delete Rows from matrix -


this question has answer here:

i have vector x (786432*1) , t(786432*1).

i want delete rows x have value 2 , want delete same(corresponding)rows of t -(for example delete x(1,1) , t(1,1)) no important t values. confusing loop (index)

> [r c]=find(x==2); 

how find same r , c in vector t?

how implement in matlab? please 1 can help!

you got how find indices remove:

idxs = find(x==2); 

you can remove element @ indices with:

x(idxs) = []; t(idxs) = []; 

example:

>> x=randi(10,1,7); >> t=randi(10,1,7); >> x  x =      10     3     2     2     1     5     5  >> t  t =       6     9     3     4     2    10     7  >> idxs = find(x==2)  idxs =       3     4  >> x(idxs)=[]  x =      10     3     1     5     5  >> t(idxs)=[]  t =       6     9     2    10     7  >>  

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -