Extracting specific parts of an array
조회 수: 5 (최근 30일)
이전 댓글 표시
I have two sets of data in a 1x500000 array (data_time and data_velocity). I want to extract the values from both arrays, where the data_velocity is <0.1 and >-0.1 to a separate array. The goal is to extract the data where there is near zero velocity, but keep the time values.
댓글 수: 0
답변 (1개)
Mischa Kim
2021년 1월 5일
편집: Mischa Kim
2021년 1월 5일
Assuming your variable is called data_velocity use something like:
extractdata = data_velocity(data_velocity<0.1 & data_velocity>-0.1)
댓글 수: 3
Mischa Kim
2021년 1월 8일
There are a couple of ways to achieve this. E.g.
data = [1 2 3 0 5 6 7 8 9 10;...
0.1 0 0 -0.2 -0.1 0 0 0 0.05 -0.05];
[row,col] = find(data(:,:)<0.1 & data(:,:)>-0.1);
extractdata = data(:,col)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!