Alternative to 'ismember' for structures
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Enrico Anderlini
le 26 Août 2016
Commenté : Enrico Anderlini
le 26 Août 2016
Hello! I have a structure, which I need to update at every step. However, I would like to include the update only if it has not been stored yet. This would be quite easy with a list and ismember. However, ismember does not work with structures. Has anyone got any suggestions? Thank you!
As an example, for greater clarity, consider the following problem:
A.a = 1;
A.b = 2;
A(2).a = 2;
A(2).b = 3;
A(3).a = 3;
A(3).b = 4;
B.a = 2;
B.b = 3;
Now, it is clear that B is contained within A (line 2, or B=A(2)).
If they were lists, I would use the command:
ismember(B,A,'rows);
What can I do if I would like to keep them as structures? Thank you!
0 commentaires
Réponse acceptée
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Structures 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!