A = cell(20,11); size(A) ans = 20 11 works for me... ? Or do you want the size of the contents of each cell? cellsz = cellfun(@size,A,'uni',false); *Addendum per comment:* I still am not getting what you want. clear A >> A{1} = single(ones(4)); >> A{2} = uint8(toeplitz(1:10)); >> A{3} = 'Hello World' A = [4x4 single] [10x10 uint8] 'Hello World' >> size(A) ans = 1 3 >> cellsz = cellfun(@size,A,'uni',false); >> cellsz{:} ans = 4 4 ans = 10 10 ans = 1 11 Answer from Sean de Wolski on mathworks.com
🌐
MathWorks
mathworks.com › matlab › language fundamentals › data types › cell arrays
cell - Cell array - MATLAB
Beyond the second dimension, cell ignores trailing dimensions with a size of 1. For example, cell([3 1 1 1]) produces a 3-by-1 cell array of empty matrices. Example: sz = [2 3 4] creates a 2-by-3-by-4 cell array of empty matrices. Data Types: double | single | int8 | int16 | int32 | int64 | ...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 40774-finding-size-of-a-cell
Finding size of a cell - MATLAB Answers - MATLAB Central
June 10, 2012 - https://www.mathworks.com/matlabcentral/answers/40774-finding-size-of-a-cell#answer_50414 · Cancel Copy to Clipboard · Could you nest your cell array, using the line · >> A{k}{i,j}=num2str(100*k+10*i+j); Then use · >> size(A{2}) Volkan Kandemir on 10 Jun 2012 ·
🌐
MathWorks
mathworks.com › matlabcentral › answers › 517683-problems-getting-the-size-of-a-cell-array
Problems getting the size of a cell array - MATLAB Answers - MATLAB Central
April 14, 2020 - I know that one can usually get the size of a cell array using size(). However, I am facing this particular case -- where I am trying to read data from a .txt file, and save it to a matrix -- where a particular row of the cell (data.textdata{2}) just refuses to show its actual size on using size(). I need the length to loop over data.textdata{2}. ... %% data is in data.textdata. In particular, data.textdata{2}, which is a matrix, refuses to show its size. size(data.textdata{2}) % only gives the size of the first character array · I am attaching the code and the text file. Can someone please help? ... https://www.mathworks.com/matlabcentral/answers/517683-problems-getting-the-size-of-a-cell-array#comment_827308
Find elsewhere
🌐
MathWorks
mathworks.com › matlabcentral › answers › 75980-displaying-the-size-of-cell-array
Displaying the size of cell array - MATLAB Answers - MATLAB Central
May 16, 2013 - I Have a database called DB and when I run DB at the command window I get: DB = Template: {'date' 'name' 'phone number'} Records: [1x24 struct] Well, I want it to sho...
🌐
MathWorks
mathworks.com › simulink › block and blockset authoring › author block algorithms › author blocks using matlab › author blocks using matlab functions › programming for code generation › data definition › cell arrays
Control Whether a Cell Array Is Variable-Size - MATLAB & Simulink
c becomes a variable-size homogeneous cell array with dimensions 1-by-:10. To force c to be homogeneous, but not variable-size, specify that none of the dimensions vary. For example: function y = mycell() %#codegen c = {1 [2 3]}; coder.varsize('c', [1 2], [0 0]); y = c{2}; end ...
🌐
TutorialsPoint
tutorialspoint.com › matlab › matlab_cell_arrays.htm
MATLAB - Cell Arrays
Here is the difference between ... we need to make use of braces {}. ... The cell array we created above is of size 1x2 i.e one row and two columns....
Top answer
1 of 1
11
A MATLAB variable consists of: Structure (about 60 bytes on a 32-bit system, a bit more on 64-bit systems) containing information such as: - Class - Type (temporary, normal, sub-element, etc) - Dimensions - Pointers to data (real & imaginary) - Pointers to sparse indexing (if applicable) - Pointers to field names (for structs) - A few other things A double variable is all of the above, with data pointer(s) pointing to an array of double data. A single variable is all of the above, with data pointer(s) pointing to an array of single data. A char variable is all of the above, with data pointer pointing to an array of char data (2-bytes per char, btw). Etc. A cell array is all of the above, with data pointer pointing to an array of other MATLAB variable pointers. E.g., in a double class variable, the "data" of the variable is 64-bit IEEE double precision values. For a cell array, the "data" of the variable is 32-bit pointers to the 60-byte variable structures of other variables (64-bit pointers on 64-bit systems) When you create a cell array with the cell function, e.g., A = cell(1,2); The variable A is all of the above, but the "data" of the cell array variable is an array of all NULL pointers (0). I.e., there is really nothing there at all. When you de-reference such an array like this: A{1,1} MATLAB actually creates a brand new empty double matrix on the fly. When you fill a cell array element with an explicit empty double matrix like this: B{2} = []; MATLAB creates a brand new cell array B (assuming B did not already exist) with two data elements. The first element is actually NULL (0) and nothing is there. The second element actually has a variable pointer in it that is not NULL ... it points to another MATLAB variable that happens to be an empty double matrix. The B elements *look* a lot like variable A elements above (empty double matrices), but behind the scenes they are stored differently as outlined above. But even though they are stored differently behind the scenes, the isequal function still considers the elements equal since the NULL pointers get virtually equated to physically present empty matrices. If you fill a cell element with something like this: B{1} = [1 2 3]; MATLAB creates a shared data copy of the right-hand-side and puts the pointer to this shared data copy into the first data spot of B. When you subsequently de-reference the cell array element like this: B{1} MATLAB considers this an expression and evaluates it as a shared data copy of the variable that is actually in the B{1} spot. A struct array is *very* similar to a cell array in that the "data" of a struct array is pointers to the 60-byte structures of other MATLAB variables. The difference is the extra complication of indexing into the data elements via the field names. Also, you need to be very careful using the whos function when comparing variable memory footprints, since the whos function does not take into account variable sharing. E.g., consider the following formulations for A and B and the subsequent whos command: >> A = cell(1,1000); >> A(:) = {1:1000}; >> B = cell(1,1000); >> for k=1:1000; B(k) = {1:1000}; end >> whos Name Size Bytes Class A 1x1000 8060000 cell array B 1x1000 8060000 cell array k 1x1 8 double array Grand total is 2002001 elements using 16120008 bytes >> isequal(A,B) ans = 1 It sure looks like A and B take the same amount of memory, and in fact their data is equal according to the isequal function. But in fact the actual memory footprint for A is *much* smaller than the memory footprint for B. That is because the data elements of A, the pointers themselves, are in fact exactly equal to each other ... i.e. all 1000 elements of A point to exactly the same MATLAB variable (sub-element sharing aka reference copy). But in variable B, each element was created new each time through the loop and thus it is a brand new variable that takes more storage. The memory footprint for B really *is* very large as indicated. To see this: >> feature memstats Physical Memory (RAM): In Use: 3545 MB (dd990000) >> clear A >> feature memstats Physical Memory (RAM): In Use: 3545 MB (dd964000) >> clear B >> feature memstats Physical Memory (RAM): In Use: 3537 MB (dd1e5000) Clearing A didn't do much of anything to the actual used memory, but clearing B sure did !
🌐
GeeksforGeeks
geeksforgeeks.org › software engineering › cell-arrays-in-matlab
Cell Arrays in MATLAB - GeeksforGeeks
April 28, 2025 - The resultant cell array would be of (3x2)x3 size. The elements of a cell array can be accessed by the same method of accessing ordinary arrays, by the indexing method. Let us see this with the help of an example.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 42199-adding-up-sizes-of-cell-arrays
Adding up sizes of cell arrays - MATLAB Answers - MATLAB Central
June 27, 2012 - The following command will return a 1-by-NumberOfClasses double array, where the jth element gives the number of elements composing the array stored in CellArray{j}. ... (Make sure you clear your variable sum - in your question's original code - before issuing the above command) Sign in to comment. Sign in to answer this question. MATLAB Language Fundamentals Matrices and Arrays Matrix Indexing
🌐
MathWorks
mathworks.com › matlabcentral › answers › 372172-how-to-find-the-minimum-length-of-a-cell-array
How to find the minimum length of a cell array - MATLAB Answers - MATLAB Central
December 10, 2017 - https://www.mathworks.com/matl... Edited: Stephen23 on 11 Dec 2017 · Open in MATLAB Online · Simpler and faster: min(cellfun('size',M,2)) Sign in to comment....