i cannot find the minimum values for matrix.
조회 수: 3 (최근 30일)
이전 댓글 표시
theres no problem to find maximum values. but when it come to find minimum values, got error as below.
can somebody tell me what is the error mean ? and how exactly to find the minimum values in each colum in matrix T ?
Thank you,
T =
1.0000 242.0000 24.7385 33.8409 1.0000
2.0000 716.0000 83.2151 50.1744 1.0000
>> M = max (T)
M =
2.0000 716.0000 83.2151 50.1744 1.0000
>> N = min (T)
Array indices must be positive integers or logical values.
댓글 수: 1
Erivelton Gualter
2019년 11월 19일
편집: Erivelton Gualter
2019년 11월 19일
I could not reproduce this error. The following works fine to me.
T =[1.0000, 242.0000, 24.7385, 33.8409, 1.0000; ...
2.0000, 716.0000, 83.2151, 50.1744, 1.0000]
M = max (T)
N = min (T)
채택된 답변
Erivelton Gualter
2019년 11월 19일
Alternative method to find the minium value for each column:
min(T,[],1)
댓글 수: 4
Daniel M
2019년 11월 19일
This answer shouldn't have worked. You must have inadvertently solved the issue of overloading the min function.
Otherwise, to get the min of just some columns, only pass in those columns:
T = [1.0000 242.0000 24.7385 33.8409 1.0000; 2.0000 716.0000 83.2151 50.1744 1.0000];
cols = [1 3 5]; % pick these columns
N = min(T(:,cols));
추가 답변 (1개)
Daniel M
2019년 11월 19일
You must have overwritten 'min' as a variable, and doing min(T) is trying to index into a variable at non-integer positions. That, or you've overloaded the function min with another. To check for this, what is the output of
which min -all
Also, copy and paste the following code exactly, and tell me if it works
clear all
T = [1.0000 242.0000 24.7385 33.8409 1.0000; 2.0000 716.0000 83.2151 50.1744 1.0000];
min(T)
댓글 수: 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!