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, :)

 Akzeptierte Antwort

Simon Chan
Simon Chan am 10 Jul. 2021
Bearbeitet: Simon Chan am 10 Jul. 2021

0 Stimmen

Do you want this?
d=C(C(:,2) == 1 & C(:,3) == 2)

2 Kommentare

Jonas
Jonas am 10 Jul. 2021
probably
d=C(C(:,2) == 1 & C(:,3) == 2,:)
abdul rehman
abdul rehman am 10 Jul. 2021
yes exactly

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by