Removing data from matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
sooraj ajith
le 22 Fév 2021
Commenté : sooraj ajith
le 22 Fév 2021
Hi, i have a set of n x 3 matrix. Such as A = [1 0 0;2 0 0 ; 3 0 0; 4 0 0 ]. I have my initial value, like [4 0 0 ]. I want to find my initial value from matrix and delete that row from my the matrix
0 commentaires
Réponse acceptée
KALYAN ACHARJYA
le 22 Fév 2021
Modifié(e) : KALYAN ACHARJYA
le 22 Fév 2021
One way:
int_dat=[4 0 0];
A =[1 0 0;2 0 0 ; 3 0 0; 4 0 0];
[r,c]=size(A);
idx=A==int_dat;
row_num=find(sum(idx')==c);
A(row_num,:)=[]
Result:
A =
1 0 0
2 0 0
3 0 0
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!