multiple conditions in matrix

3 visualizaciones (últimos 30 días)
abdul rehman
abdul rehman el 10 de Jul. de 2021
Comentada: abdul rehman el 10 de Jul. de 2021
I am receiving this error while applying multipe conditions in matrix
Code:
C= [rand(100,1),randi([0,2],100,1),randi([0,2],100,1),randi([5,12],100,1)]
d=C(C(:,2) == 1,: && (:,3) == 2, :)

Respuesta aceptada

Simon Chan
Simon Chan el 10 de Jul. de 2021
Editada: Simon Chan el 10 de Jul. de 2021
Do you want this?
d=C(C(:,2) == 1 & C(:,3) == 2)
  2 comentarios
Jonas
Jonas el 10 de Jul. de 2021
probably
d=C(C(:,2) == 1 & C(:,3) == 2,:)
abdul rehman
abdul rehman el 10 de Jul. de 2021
yes exactly

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by