Effacer les filtres
Effacer les filtres

merging two matrices (cell matrices)

3 vues (au cours des 30 derniers jours)
ARS
ARS le 7 Sep 2013
Hi,
I have two cell matrices with same dimensions (63,820)
for each cell of Matrix AA there is a corresponding numeric value in same location cell of Matrix BB. However, there are many instances where Matrix BB has NaN values.
I wish to have a Matrix CC which should be exactly same as Matrix AA but it should replace/swap its cell's contents to 'NaN' if the corresponding value of the same location cell in BB is a NaN.
Any body with a short code?
All help will be appreciated.
Regards,
AMD.

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 7 Sep 2013
Modifié(e) : Azzi Abdelmalek le 7 Sep 2013
AA={1 2 3;4 5 6;7 8 9}
BB={10 nan 2;nan 5 55;nan 44 66}
CC=AA
CC(cellfun(@isnan,BB))={nan}
  1 commentaire
ARS
ARS le 7 Sep 2013
Thanks a lot Azzi....Appreciate your help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices 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!

Translated by