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?

 Respuesta aceptada

Matt J
Matt J el 14 de Feb. de 2022
Editada: Matt J el 14 de Feb. de 2022
a={'hi' 'lo' 'hi'};
b={'lo' 'hi' 'hi'};
nnz(string(a)=="hi" & string(b)=="hi")
ans = 1

Más respuestas (0)

Categorías

Más información sobre Language Fundamentals en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 14 de Feb. de 2022

Editada:

el 14 de Feb. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by