Filter löschen
Filter löschen

reshaping matrix with odd number of total elements

6 Ansichten (letzte 30 Tage)
klb
klb am 28 Okt. 2018
Kommentiert: klb am 28 Okt. 2018
how can I reshape a 63X5 matrix (315 elements) into a mX2 , and a mX4 matrix?
  2 Kommentare
Walter Roberson
Walter Roberson am 28 Okt. 2018
If the data were in the order
A1 B1 C1 D1 E1
A2 B2 C2 D2 E2
A3 B3 C3 D3 E3
and so on, then what would be the desired output order?
klb
klb am 28 Okt. 2018
Bearbeitet: klb am 28 Okt. 2018
The 65X5 matrix is all combinations of the vector [1 2 3] with replacement, which I wanted to reshape to m X 2 and m x 4 matrix and eliminate duplicates.
Another way to state problem is how would I reshape [1 2 3] in to a m X 2 and m X 4 matrix. With repetition.
[1 2 3]
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
and 1 3 not = 3 1 etc.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 28 Okt. 2018
  1 Kommentar
klb
klb am 28 Okt. 2018
Thank you! I will come back to reshaping matrix with odd no. of elements, another time.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Bruno Luong
Bruno Luong am 28 Okt. 2018
You can't
  1 Kommentar
Walter Roberson
Walter Roberson am 28 Okt. 2018
At least not without either discarding elements or padding with something.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by