How to extract certain indexes from a vector, but keeping the length the same by filling the rest u with NaNs
조회 수: 1 (최근 30일)
이전 댓글 표시
Milena Vildósola Bustos
2022년 1월 20일
댓글: Milena Vildósola Bustos
2022년 1월 20일
I have a vector with angles of a body segment. I have another vector with the indexes of the angles at take-off (during walking). I want select the angles at take-off only, but keeping the length of the vector the same and replacing the rest of the data of the angles to NaNs so i can still work with the time. I want to compare different time sections and if i only take out the take-off data, the vector will be smaller and i wont be able to see at what time the take-off was.
댓글 수: 0
채택된 답변
Max Heimann
2022년 1월 20일
You can try something like this:
angleVector = rand(1,10);
indexVector = [3 4 5 6];
nanVector = NaN(1,length(angleVector));
nanVector(indexVector) = angleVector(indexVector)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!