Identifying same values of two arrays
Afficher commentaires plus anciens
I have two string arrays: array1 and array2. I want to create a variable named change that is equal to 0 if array1 and array2 are equal or one of them is NaN and 1 otherwise.
array1 array2 change
A A 0
A A 0
A C 1
C C 0
C C 0
NaN B 0
3 commentaires
Soniya Jain
le 26 Juin 2021
In question you are saying " to create a variable named change that is equal to 1 if array1 and array2 are equal or one of them is NaN and 0 otherwise. ", but in output you are showing vice versa. Can you confirm exact what results do you want?
Also, post what you have tried, and we may help you along.
Scott MacKenzie
le 26 Juin 2021
Further to @Soniya Jain's comment, what are A, B, and C in array1 and array2? Are they variables? Or, are they character or string literals? If they are variables, what type of data do they hold?
Mia Dier
le 26 Juin 2021
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!