Searching and Manipulating Cell Array - Part 2
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
This is a new problem but the problem data is similar.
I have a cell array A:
[3,2]
[2,4]
[4,5]
[2,5]
[6]
and cell array B:
[2,3,4]
[2,6]
[4,5,6]
In the array B I can see that [2,3,4] is made of elements from [3,2] and [2,4] from A. So, I will assign these two elements from A to B and remove them from A.
A now has:
[4,5]
[2,5]
[6]
[2,5] in B is made from elements of [4,5] and [2,5] from A. So, we assign [4,5] and [2,5] to second element of B and so on. Please observe in second example that 4 was an extra element from A which was not present in B at all but still I want to assign [4,5] and [2,5] to second element of B. We delete them from A.
Now A has only:
[6]
So, how do I achieve this?
Thanks guys
2 commentaires
Matt J
le 20 Oct 2012
Modifié(e) : Matt J
le 20 Oct 2012
Quote: "[2,5] in B is made from elements of [4,5] and [2,5] from A."
B as you've listed it does not show a [2,5]. It does show a [2,6]
Also, even if B did include [2,5], it wouldn't require elements from [4,5] in A since the [2,5] in A completely covers the [2,5] in B.
Matt J
le 20 Oct 2012
Quote: "Please observe in second example that 4 was an extra element from A"
If extra elements don't matter, why not use all of A to cover B{1}. Also, what if there are multiple different ways to cover a B{i} with members of A? Does it matter which one we pick?
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!