I have a 201x551 matrix of height values, collected by LIDAR, showing a tidal estuary. The estuary runs diagonally across the figure (SW to NE), and I need to create a 2D representation of a cross section through the estuary (i.e. a transect from NW to SE). How can I create a vector which bes represents the values between (1,1) and (201,551).
Thanks for your help,
Max

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2017년 9월 26일
편집: Andrei Bobrov 2017년 9월 26일

0 개 추천

Let A - your array.
[m,n] = size(A);
if m > n, ii = sub2ind([m,n],1:m,ceil((1:m)*n/m));
elseif m < n, ii = sub2ind([m,n] ,ceil((1:n)*m/n),1:n);
else, ii = 1:m+1:m*n;
end
out = A(ii);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

질문:

2017년 9월 26일

댓글:

2017년 9월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by