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

0 votos

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 Centro de ayuda y File Exchange.

Productos

Versión

R2021a

Preguntada:

el 10 de Jul. de 2021

Comentada:

el 10 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by