Arrange the values in a Matrix in a way (line by line)

1 Ansicht (letzte 30 Tage)
walid albugami
walid albugami am 29 Jun. 2021
Kommentiert: Stephen23 am 30 Jun. 2021
Please i need help in how to arrange the values in a Matrix in a way (line by line).
for exemple: i would like to be able to convert in a generale way the G matrix in F Matrix. i just choose the size of (4*5) as an exemple. the Matrix that i should handle in reality is much bigger (it is 1544 * 2064). (Note: it is not a square Matrix)
G =
3 3 9 1 9
3 5 8 1 8
6 3 10 2 6
6 3 9 7 4
F =
3 3 6 6 3
5 3 3 9 8
10 9 1 1 2
7 9 8 6 4

Antworten (2)

Jan
Jan am 29 Jun. 2021
Bearbeitet: Jan am 29 Jun. 2021
G = [3 3 9 1 9; ...
3 5 8 1 8; ...
6 3 10 2 6; ...
6 3 9 7 4];
s = size(G);
F = zeros(s(2), s(1));
F(:) = G(:);
F = F.'
F = 4×5
3 3 6 6 3 5 3 3 9 8 10 9 1 1 2 7 9 8 6 4

David Hill
David Hill am 29 Jun. 2021
F=reshape(G,5,4)';
  2 Kommentare
walid albugami
walid albugami am 29 Jun. 2021
it works well
thank you very much
have a nice night
best regars
Stephen23
Stephen23 am 30 Jun. 2021
Note that it is good practice to use transpose rather than complex conjugate transpose.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by