celldisp

Displays the contents of every cell of a cell array.

Category: Language Fundamentals > Data Types

Syntax

celldisp(c)

Prints each cell, labeled with the variable name or ans.

celldisp(c, name)

Uses name as the label.

Description

celldisp walks through the cells in column-major order and prints each as name{k} = value, using a linear index for vectors and name{i,j} for matrices. Nested cells are shown as a compact cell, not expanded further.

It prints to the screen only; use c{k} to get a value.

Input arguments

c
Cell array.
name
Text used in the labels such as name{2}.

Example

Labeled output

celldisp({[1 2; 3 4], 'text'}, 'c')
Output
 
c{1} =
 
     1     2
     3     4

 
 
c{2} =
 
text

See also

disp cellfun cell2mat iscell