Splitting data in Matlab
1 view (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Adam Danz
on 18 Jun 2019
Edited: Adam Danz
on 18 Jun 2019
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 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!