find numbers that exceed the 50

조회 수: 2 (최근 30일)
flashpode
flashpode 2021년 11월 8일
편집: Kevin Holly 2021년 11월 8일
Hi, I've got a variable that has many numbers and I wanted to find all the numbers that exceed the number 50 (with the position of it). My variable is double.

채택된 답변

Kevin Holly
Kevin Holly 2021년 11월 8일
편집: Kevin Holly 2021년 11월 8일
There is probably a better way to do the indexing, but here is my approach.
var = [ 40 30 23 90 89 53 23 123 32 50 21 32 4 65 1 100 64 29 39 293 24 57 97];
pos = 1:numel(var);
value = var(var>50)
value = 1×10
90 89 53 123 65 100 64 293 57 97
index = pos(var>50)
index = 1×10
4 5 6 8 14 16 17 20 22 23

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by