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

조회 수: 84 (최근 30일)
Ciaran OReilly
Ciaran OReilly 2021년 6월 24일
답변: millercommamatt 2021년 6월 24일
I have a 1x3 cell, or and need to change this to a 3x1.
How do I do this??

답변 (2개)

Mouhamed Niasse
Mouhamed Niasse 2021년 6월 24일
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 2021년 6월 24일
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

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by