フィルターのクリア

Splitting data in Matlab

1 回表示 (過去 30 日間)
Frane Calusic
Frane Calusic 2019 年 6 月 18 日
編集済み: Adam Danz 2019 年 6 月 18 日
Hello guys,
I have a data in Matlab which size is 10797x3. It has 3 columns (1st is time,2nd is wind speed and 3rd is azimuth angle). I need to separate wind speeds from that data into 2 columns. The first column shoud have wind speed's from let's say 5-10 m/s and the other shoud have wind speed's above 10 m/s. How can I do that?
Thanks!
P.S. I've putted the data here as well.

採用された回答

Adam Danz
Adam Danz 2019 年 6 月 18 日
編集済み: Adam Danz 2019 年 6 月 18 日
Since there might not be an equal number of wind speeds above and below your threshold, you shouldn't use a matrix (which requires an equal number of rows). Instead, use a cell array.
Here's how to identify rows that have wind speeds between [5,10] and rows that have wind speeds >10.
set1Idx = Podaci(:,2) >= 5 & Podaci(:,2) <= 10; %index of rows that are between [5,10]
set2Idx = Podaci(:,2) > 10; %index of rows that are above 10.
Use those indices as needed. Try to avoid splitting up your data into different variables. Here's an example that averages azimuth according to your groups.
m1 = mean(Podaci(set1Idx,3));
m2 = mean(Podaci(set2Idx,3)):

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by