Taking Absolute value of a cell arrray

14 ビュー (過去 30 日間)
Chris Dan
Chris Dan 2020 年 7 月 9 日
コメント済み: madhan ravi 2020 年 7 月 9 日
Hi
I want to take an absolute value of a cell array, but I am getting this error
"Unable to perform assignment because brace indexing is not supported for variables of this type."
I am attaching the file for which I want to take the absolute value and I am using this code
L = 128;
for i =1:1:size(Numerical_FourierForce,1)
for j =1:1:size(Numerical_FourierForce,2)
P2{i,j} = abs(Numerical_FourierForce{i,j}/L);
end
end
It is working if I remove the "L" from the loop, but I want to do it with it
Does anybody knows?

採用された回答

madhan ravi
madhan ravi 2020 年 7 月 9 日
編集済み: madhan ravi 2020 年 7 月 9 日
clear all
load NumericalFourierForce % note i haven’t seen your .mat file, shooting in the dark
L = 128; % make sure there isn’t any variable named L in the .mat file
P2 = cell(size(NumericalFourierForce));
for ii =1:size(Numerical_FourierForce,1)
for jj =1:size(Numerical_FourierForce,2)
P2{ii,jj} = abs(Numerical_FourierForce{ii,jj}/L);
end
end
  3 件のコメント
madhan ravi
madhan ravi 2020 年 7 月 9 日
num2cell(P2{1,1})
madhan ravi
madhan ravi 2020 年 7 月 9 日
cellfun(@num2cell, P2, 'un', 0)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by