Multiplication between elements of two different cells

조회 수: 2 (최근 30일)
Amit Chakraborty
Amit Chakraborty 2021년 10월 9일
댓글: Amit Chakraborty 2021년 10월 9일
F= num2cell(rand(360,4^3),2);
T= num2cell(rand(10,4^3),2);
RR = F{1:36}.*T{1};
EE = F{37:73}.*T{2};
Error :: Error using .* . Too many input arguments.
Explanation what I actually want :
Here, the size of F and T is 360x1 cell and 10x1 cell respectively. I want to multiply in such a manner that the : first 36 row of F will be multiplied by the first row of T and next 36 row of F will be multiplied by second row of T and continue the like this. And the resultant Matrix will have the size (360,4^3). I am getting error and may be my logic in code is also wrong. Any kinds valuable suggestions will be appreciated.
Thanks in Advance.
  댓글 수: 1
Stephen23
Stephen23 2021년 10월 9일
편집: Stephen23 2021년 10월 9일
"Any kinds valuable suggestions will be appreciated."
Probably using numeric arrays would be much simpler. What you want looks like it could be achieved by one simple call to TIMES or MTIMES with appropriately sized arrays.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2021년 10월 9일
"first 36 row of F will be multiplied by the first row of T and next 36 row of F will be multiplied by second row of T and continue the like this."
F = rand(360, 4^3);
T = rand(10, 4^3);
FF = reshape(F, 36, 10, []);
TT = reshape(T, 1, 10, []);
Result = reshape(FF .* TT, 360, []);
Converting the arrays into a cell is not useful.
  댓글 수: 1
Amit Chakraborty
Amit Chakraborty 2021년 10월 9일
@Jan Thanks for the answer.
@Jan @Stephen Thank you so much for the valuable suggestions and sharing your knowledge.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by