How to use a loop to calculate m*n values for an mxn matrix?
显示 更早的评论
I have two matrices, both approximately 100x100, call them A and B. I am trying to multiply every element of matrix A by every element of matrix B and output these values to a third matrix. In reality, I am doing a little bit more than multiplication, but the operation itself isn't my problem. I am having trouble figuring out how to organize this within a loop.
Any suggestions are greatly appreciated!
1 个评论
Jan
2013-9-27
As usual it would be helpful, if you post, what you have tried so far an explain, which problems occur.
采纳的回答
更多回答(1 个)
Ilham Hardy
2013-9-27
编辑:Ilham Hardy
2013-9-27
Is it something like this?
A = [1 2 3 4; 5 6 7 8; 9 10 11 12];
B = [2 2 2 2; 3 3 3 3; 4 4 4 4];
>> C = A.*B
C =
2 4 6 8
15 18 21 24
36 40 44 48
2 个评论
Ilham Hardy
2013-9-27
Sorry, i didn't read your question carefully.
Could you elaborate more on the "a little bit more than multiplication" -part?
Perhaps a simple example of your matrix and the operation?
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!