Effacer les filtres
Effacer les filtres

I am trying to split the following data set into 2 based on whether the values in the 7th column (etd) are greater than or less than 25

1 vue (au cours des 30 derniers jours)
I tried using this code but it returned multiple errors.
column7 = datasets(:,7)
for i = 1:numel(column7)
if column7(i) > 25
above25(i) = column7(i)
elseif column7(i) < 25
below25(i) = column7(i)
end
end
above25(above25==0)=[]
below25(below25==0)=[]
  3 commentaires
James Oxborrow
James Oxborrow le 1 Sep 2018
haha, same person. I thought i'd fixed it but it still isn't working.

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 1 Sep 2018
Let data be you matrix of whole data.
iwant1 = data(data(:,7)<25,:) ;
iwant2 = data(data(:,7)>=25,:) ;
  2 commentaires
James Oxborrow
James Oxborrow le 1 Sep 2018
Now its giving me the error
"Undefined operator '<' for input arguments of type 'dataset'."
is this because my data is in a dataset not a matrix? if so how would i change it?
James Oxborrow
James Oxborrow le 1 Sep 2018
I've converted it to a matrix and that works great. Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical 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