MATLAB: Cellfun with Frobenius norm

cellfunfrobeniusnorm

Hi all,
I'd like to obtain Frobenius norm for each element in a cell, I wrote this:
a1 = (1:6)';
a2 = (2:7)';
a3 = (3:8)';
a = {a1 a2 a3};
nm.a = cellfun(@norm, a);
However, if I want a Frobenius norm, I'll need norm(x, 'fro'), how can I add 'fro' in this case in cellfun?
Thank you!

Best Answer

Use an anonymous function:
nm.a = cellfun(@(m) norm(m, 'fro'), a)
Related Question