Clear Filters
Clear Filters

Dividing elements of matrices where the matrices are in a cell array

7 views (last 30 days)
I am trying to divide a cell array with identically sized matrices with elements by a scalar value. I did it previously but need help remembering how to do it... i don't remember if i used an anonymous function of cellfun.
scale = cellfun(@(x) x./19.6,rundata,'UniformOuput', false);
This is currently what I have where rundata is my cell array and 19.6 is the scalar I want to divide by.

Accepted Answer

Matt J
Matt J on 17 Jul 2021
Edited: Matt J on 17 Jul 2021
What you've shown should work, but since the cell array contents are identical, it would be faster to do,
scale=rundata;
scale(:)={rundata{1}/19.6};

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!