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

조회 수: 5 (최근 30일)
Curtis Lam
Curtis Lam 2021년 7월 17일
댓글: Curtis Lam 2021년 7월 17일
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.

채택된 답변

Matt J
Matt J 2021년 7월 17일
편집: Matt J 2021년 7월 17일
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};

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by