I have row vectors how can I extract one element from this vector;
A=[1 2 3 4 5]; how extract max value (5)from A MATRIX
to be A=[1 2 3 4]; only

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 27일

1 개 추천

A(A==max(A))=[]

댓글 수: 5

Mary Jon
Mary Jon 2013년 11월 27일
thank you Abdelmalek .
Mary Jon
Mary Jon 2013년 11월 27일
편집: Mary Jon 2013년 11월 27일
how can sum the square of the remaining elements of A
Mary Jon
Mary Jon 2013년 11월 27일
if I have complex number how can finding its magnitude
abs(a)
see also
angle(a)
imag(a)
real(a)

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

추가 답변 (1개)

Wayne King
Wayne King 2013년 11월 27일
편집: Wayne King 2013년 11월 27일

1 개 추천

In addition to Azzi's suggestion you can use
A(A~=max(A))
but keep in mind that both will remove multiple values if the max() occurs more than once.
For example:
A = [1 2 3 4 5 5];
If the max occurs more than once, you have to use a different technique to remove which entry you want. For example, say you want to just remove the first time the max occurs
maxval = max(A);
A(find(A==max(A),1,'first'))= [];

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

태그

질문:

2013년 11월 27일

댓글:

2013년 11월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by