Convert a Column Vector to Matrix

71 Ansichten (letzte 30 Tage)
Vikram Mohan
Vikram Mohan am 22 Apr. 2022
Beantwortet: Bruno Luong am 22 Apr. 2022
I have a column vector y such that
x = [1 2 3 4 5 6]
y = x'
I would like to change y into a matrix such that the first row contains the values 1 and 2. The second row contains the value 3 and 4. And finally, the last row contains 5 and 6. How can I do this?

Antworten (2)

David Hill
David Hill am 22 Apr. 2022
y=reshape(x,2,[])';

Bruno Luong
Bruno Luong am 22 Apr. 2022
x = [1 2 3 4 5 6]
x = 1×6
1 2 3 4 5 6
y = reshape(x, 2, [])'
y = 3×2
1 2 3 4 5 6

Kategorien

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

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by