How can I get the value on 2nd column that has the minimum value in 1st column?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have 200*2 matrix, first column contains data A and second column stands for x-location.
Like this,
A x
304 1
234 2
213 3
454 4
123 5
I want to extract x-location where data A is the minimum. I am really newbie in MATLAB, please understand. And if possible, I would like to know how to save the x_location to external txt or csv file. Thank you.
댓글 수: 0
답변 (1개)
the cyclist
2016년 11월 13일
M = [304 1
234 2
213 3
454 4
123 5];
[minA loc] = min(M(:,1));
xAtMin = M(loc,2);
댓글 수: 1
the cyclist
2016년 11월 13일
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!