Consider for example the function "norm". I have a matrix, and I want to apply "norm" to each row in the matrix, and get a vector of all norms for each row in this matrix.
I was hoping I could do norm(A, 'rows'), but that is not possible. Is there some other way to do it?
You can do it without converting to a cell array:
arrayfun(@(n) norm(A(n,:)), 1:size(A,1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With