Multiplication in cell arrays

1 回表示 (過去 30 日間)
BN
BN 2019 年 11 月 12 日
回答済み: David Hill 2019 年 11 月 12 日
Hey all, I have a cell (408*1), which has 408 rows of 33*33 array inside it. I attached this cell to this question (the name is precip(my_data).mat).
now I want to multiply a 408*1 double array to this cell. I attached this array too (the name numbers.mat).
so please help me to do multiply my file (numbers.mat) to my data (precip.mat). In the end I would like to have:
precip(my_data) * (numbers.mat) %each row multiplying to the same row from numbers
Thank you all in advance.

採用された回答

David Hill
David Hill 2019 年 11 月 12 日
Or a simple loop.
for i=1:408
PRECTOTCORR{i}=PRECTOTCORR{i}*result(i);
end

その他の回答 (1 件)

Matt J
Matt J 2019 年 11 月 12 日
編集済み: Matt J 2019 年 11 月 12 日
result = cat(3,precip{:}).*reshape(numbers,1,1,[]);
There seems little reason either for precip to be a cell array or to turn the result back into one. But if you must,
result=num2cell(result,[1,2]);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by