Splitting data in Matlab

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by