how to split a dataset based on values from one column

I have this dataset and want to split it into two data sets based on wether the values in the 7th column (etd) are >25 or <25. how would i go about doing this?

 採用された回答

madhan ravi
madhan ravi 2018 年 8 月 31 日
編集済み: madhan ravi 2018 年 8 月 31 日

0 投票

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)=[]

4 件のコメント

James Oxborrow
James Oxborrow 2018 年 8 月 31 日
I'm getting these 3 errors when i use that code, any idea why?
Error using dataset/subsrefParens (line 9) Dataset array subscripts must be two-dimensional.
Error in dataset/subsref (line 69) [varargout{1:nargout}] = subsrefParens(a,s);
Error in Code_new (line 58) if column7(i) > 25
madhan ravi
madhan ravi 2018 年 8 月 31 日
編集済み: madhan ravi 2018 年 8 月 31 日
Can you upload the file?
madhan ravi
madhan ravi 2018 年 8 月 31 日
編集済み: madhan ravi 2018 年 8 月 31 日
Upload the data file to test.
James Oxborrow
James Oxborrow 2018 年 8 月 31 日
donn't worry, i figured it out. Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2018 年 8 月 31 日

編集済み:

2018 年 8 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by