Identifying same values of two arrays
Show older comments
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 Comments
Soniya Jain
on 26 Jun 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
on 26 Jun 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
on 26 Jun 2021
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!