필터 지우기
필터 지우기

find maximum value of column when row is known and value of Array is non zero?

조회 수: 1 (최근 30일)
if true
% code
A = [51 2 3 nan;
4 5 6 7;
42 16 45 63;
NaN 2 56 12;
NaN 45 26 32];
how to code for max value of column for 1st row where A is not a NaN.

채택된 답변

Jan
Jan 2018년 10월 17일
편집: Jan 2018년 10월 17일
Maybe you want:
A = [51 2 3 nan;
4 5 6 7;
42 16 45 63;
NaN 2 56 12;
NaN 45 26 32];
index = find(~isnan(A(:, 1)), 1, 'last')
value = A(index, 1)
This replies the index and value of the bottommost non-NaN element in the first column of A.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by