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 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194922/image.png)
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 个评论
采纳的回答
KSSV
2018-9-1
Let data be you matrix of whole data.
iwant1 = data(data(:,7)<25,:) ;
iwant2 = data(data(:,7)>=25,:) ;
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!