image thumbnail


version (1.68 KB) by Stephen Lienhard
Apply a function looping over a dimension of a matrix


Updated 16 Nov 2007

View License

This function should help when it is difficult to generalize a function to operate on all dimensions.

Take the eig of each page in the 3rd dimension

b = apply(@eig,rand(4,4,3),3,'uni',0)

Normalize each column
b = apply(@norm, rand(5,3), 2)

Normalize each row
b = apply(@norm, rand(5,3), 1)

Cite As

Stephen Lienhard (2022). apply (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!