Filter Matrix over a specific value

조회 수: 65 (최근 30일)
Eren Atar
Eren Atar 2022년 6월 14일
답변: Dyuman Joshi 2022년 6월 14일
data = [1:10];
idx = data > 5;
%output only logical values
I want to filter my values, aim would be to get all values in a matrix that are bigger than 5 and everything below should be "deleted".
So the new dimension for this example would be 1x4 [6,7,8,9,10].
How can I implement this?
  댓글 수: 1
Stijn Haenen
Stijn Haenen 2022년 6월 14일
Like this?
data=1:10;
new_data=data(data>5);

댓글을 달려면 로그인하십시오.

채택된 답변

Dyuman Joshi
Dyuman Joshi 2022년 6월 14일
The new dimension would be 1x5, not 1x4
data=1:10
data = 1×10
1 2 3 4 5 6 7 8 9 10
data(data>5)
ans = 1×5
6 7 8 9 10

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by