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);

1 件のコメント

Max Campbell
Max Campbell 2017 年 9 月 26 日
Thankyou very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Operating on Diagonal Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by