Divide all rows of an array by another array
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Given an array
[3 -5 6 8;
5 8 10 -3;
6 8 3 4]
I want to divide each row based on a set of numbers
[1; 2; 3; 4]
to produce
[3/1 -5/2 6/3 8/4;
5/1 8/2 10/3 -3/4;
6/1 8/2 3/3 4/4]
or
[3 -2.5 2 2;
5 4 3.33 -0.75;
6 4 1 1]
0 Commenti
Risposta accettata
Image Analyst
il 14 Mag 2024
Use the automatic expansion capability:
m = [3 -5 6 8;
5 8 10 -3;
6 8 3 4];
columnVector = [1; 2; 3; 4]
output = m ./ columnVector'
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!