How do I take one matrix, divide by another, to make a bunch of new matrices with the dimension of the original matrix, but each scaled by each element of the second matrix?

2 views (last 30 days)
Hello!
I have a question. I have a matrix, 91 by 93, and i want to divide each element of the matrix by a scalar. However, I have a large amount of scalars in an array, and I want to create many 91 by 93 matrices each scaled by each element in the array. How would I do this quickly and simpy without having to single out each value in the array and dividing it? Also, would it be possible to store all these 91 by 93 matrices in a single matrix/variable?
If I am not clear please comment to let me know
Thanks!
-Kevin

Accepted Answer

madhan ravi
madhan ravi on 26 Jul 2020
Edited: madhan ravi on 26 Jul 2020
Wanted = matrix ./ reshape(scalar, 1, 1, []) % use bsxfun() for older versions for dividing

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!