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:
data structure question

Subject: data structure question

From: jenya polyakova

Date: 23 Oct, 2009 16:44:20

Message: 1 of 2

Dear all,
what is the matlab data structure that is best for storing matrices of vectors that are different sizes? At each location in the matrix I will have a vector. The size of this vector is different for each element in the matrix. THANKS

Subject: data structure question

From: Miroslav Balda

Date: 24 Oct, 2009 21:41:01

Message: 2 of 2

"jenya polyakova" <jenya56@yahoo.com> wrote in message <hbsmh4$q63$1@fred.mathworks.com>...
> Dear all,
> what is the matlab data structure that is best for storing matrices of vectors that are different sizes? At each location in the matrix I will have a vector. The size of this vector is different for each element in the matrix. THANKS

Hi Yenya,
I think that better than structures are cell arrays for the purpose:
 A={ones(3,1),[1,2,3],10;
      eye(5),0:10,(2:5:20)'}
A =
    [3x1 double] [1x3 double] [ 10]
    [5x5 double] [1x11 double] [4x1 double]
>> A{2,3}
ans =
     2
     7
    12
    17
Good luck
Mira
>>

Tags for this Thread

No tags are associated with 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