About vectors

조회 수: 1 (최근 30일)
Lizan
Lizan 2011년 7월 22일
Hi,
I have a vector of the size (6,51). In each column there are 3 negative values I would like to get rid off... How can I do this?
Then afterwards when I have a vector of size (3.51) (all values positive) I would like to find the maximum, minimum and the value in between and place it in a new vector each, respectively. Any hinters of how to do this?
Many thanks for any assistance.

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 7월 22일
x = sort(x,'descend'); %descend sort it
x = x(1:3,:); %keep first three rows
  댓글 수: 1
Jan
Jan 2011년 7월 22일
And these 3 rows contain the max, min and medium values in sorted order already. So Sean's method solves both problems.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by