Effacer les filtres
Effacer les filtres

array operation in matlab

1 vue (au cours des 30 derniers jours)
ali hassan
ali hassan le 14 Fév 2022
Modifié(e) : Matt J le 14 Fév 2022
if i have type cell:
a=['hi' 'lo' 'hi'];
b=['lo' 'hi' 'hi'];
how can i find total number of times when there is 'hi' in a and 'hi' in b as well?

Réponse acceptée

Matt J
Matt J le 14 Fév 2022
Modifié(e) : Matt J le 14 Fév 2022
a={'hi' 'lo' 'hi'};
b={'lo' 'hi' 'hi'};
nnz(string(a)=="hi" & string(b)=="hi")
ans = 1

Plus de réponses (0)

Catégories

En savoir plus sur Dialog Boxes 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!

Translated by