Organize the logic to transform given matrix into required

1 次查看(过去 30 天)
Given
[1 5 4 5 7
2 5 5 5 8
3 5 6 5 9]
Required
[1 2 3
4 5 6
7 8 9]

采纳的回答

Voss
Voss 2022-1-23
A = [1 5 4 5 7; 2 5 5 5 8; 3 5 6 5 9]
A = 3×5
1 5 4 5 7 2 5 5 5 8 3 5 6 5 9
B = A.'; % transpose
B = B(1:2:end,:) % take every alternate row, starting with 1st
B = 3×3
1 2 3 4 5 6 7 8 9
Or:
B = A(:,1:2:end).' % take every alternate column, then transpose
B = 3×3
1 2 3 4 5 6 7 8 9

更多回答(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