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

4 ビュー (過去 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};
  1 件のコメント
Curtis Lam
Curtis Lam 2021 年 7 月 17 日
sorry i meant identically sized matrices* not identical

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by