How do I convert a 3x1 cell to a 1x3

68 Ansichten (letzte 30 Tage)
Ciaran OReilly
Ciaran OReilly am 24 Jun. 2021
Beantwortet: millercommamatt am 24 Jun. 2021
I have a 1x3 cell, or and need to change this to a 3x1.
How do I do this??

Antworten (2)

Mouhamed Niasse
Mouhamed Niasse am 24 Jun. 2021
Hello,
In case it's a cell array, just transpose it. For example:
>> A={14; 2; 4}
A =
3×1 cell array
{[14]}
{[ 2]}
{[ 4]}
>> A=A'
A =
1×3 cell array
{[14]} {[2]} {[4]}

millercommamatt
millercommamatt am 24 Jun. 2021
The transposition operator will work.
a={1,2,3}; % 1x3 cell
a = a'; % a now a 3x1 cell
a = a'; % a is a 1x3 cell again

Kategorien

Mehr zu Data Types 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