Hello, I have the following doubt imagining that I have the vector
x=[1 2 3 4 5 6 7 8 9 10]
how can I do to reorganize it as follows
A=[1 2 3 4 5
6 7 8 9 10]
Since as we know reshape organizes as follows.
A=[1 3 5 7 9
2 4 6 8 10]
Thank u so much in advance.

1 Kommentar

Star Strider
Star Strider am 18 Aug. 2021
This seems to be homework.
In any event, just use the reshape function.
.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Wan Ji
Wan Ji am 18 Aug. 2021
Bearbeitet: Wan Ji am 18 Aug. 2021

1 Stimme

Just use reshape and transpose it!
x=[1 2 3 4 5 6 7 8 9 10] ;
A = reshape(x, 5, 2)'
Then we get
A =
1 2 3 4 5
6 7 8 9 10
This skill will usually be used in practical matlab programming

5 Kommentare

Nicolas Guerrero Naranjo
Nicolas Guerrero Naranjo am 18 Aug. 2021
Thank you su much
Wan Ji
Wan Ji am 18 Aug. 2021
I'd be glad to have your acceptance of my answer.
darova
darova am 20 Aug. 2021
Wan Ji
Wan Ji am 21 Aug. 2021
thsnk you, darova!
darova
darova am 21 Aug. 2021
my pleasure

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by