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.
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!