Effacer les filtres
Effacer les filtres

Splitting data in Matlab

1 vue (au cours des 30 derniers jours)
Frane Calusic
Frane Calusic le 18 Juin 2019
Modifié(e) : Adam Danz le 18 Juin 2019
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.

Réponse acceptée

Adam Danz
Adam Danz le 18 Juin 2019
Modifié(e) : Adam Danz le 18 Juin 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)):

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by