Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Function or Code Similar to vec2mat for Cell array

Subject: Function or Code Similar to vec2mat for Cell array

From: omegayen

Date: 15 Nov, 2010 20:04:04

Message: 1 of 2

Hi,

So if I have a vector of type double I can convert it into a matrix of the size of my specification one row at a time using

mat = vec2mat(vec,matcol)

if instead I have a vector of type cell (so a cell array) how do I do I accomplish the same transformation into a matrix one row at a time?

note my vector converts into a square matrix so no trailing zeros are needed.

Subject: Function or Code Similar to vec2mat for Cell array

From: Sean de

Date: 15 Nov, 2010 22:34:04

Message: 2 of 2

"omegayen " <omegayen@ameritech.net> wrote in message <ibs3nk$ljb$1@fred.mathworks.com>...
> Hi,
>
> So if I have a vector of type double I can convert it into a matrix of the size of my specification one row at a time using
>
> mat = vec2mat(vec,matcol)
>
> if instead I have a vector of type cell (so a cell array) how do I do I accomplish the same transformation into a matrix one row at a time?
>
> note my vector converts into a square matrix so no trailing zeros are needed.

How about:

reshape(Your_cell,matcol,[]).'

where matcol is the same as matcol in vec2mat?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us