Thread Subject: Cell array vs 3D matrix

Subject: Cell array vs 3D matrix

From: Matt Fetterman

Date: 12 Oct, 2009 17:51:04

Message: 1 of 2

Hi, I am working with a 3D array. I can create the array as A(m,n,p). For example, say m ranges from 1..70, n ranges from 1..800, p ranges from 1..800.

Or I can make the 3D array from a 1-D cell array of 2-D slices. For example B{m}, where each element of B{m} is a 2D array, such as Q(1:n,1:p), and m ranges from 1..70.

Anyways it seems to me that the cell array takes up less memory. Is it true?

Thanks Matt

Subject: Cell array vs 3D matrix

From: Matt Fig

Date: 12 Oct, 2009 18:24:06

Message: 2 of 2

A cell takes more memory.

A = rand(3,3,3);
B = squeeze(num2cell(A,[1 2]));
whos

Now look at the Bytes.
Note there may be more important considerations than memory when deciding whether to use a cell array or 3D array. Speed, for instance.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
cell array Matt Fetterman 12 Oct, 2009 13:54:05
rssFeed for this Thread

Contact us at files@mathworks.com