Multiply only certain columns in a matrix with a constant
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
dj1du
am 28 Jul. 2022
Beantwortet: Star Strider
am 28 Jul. 2022
Hello,
I have a 100x9 matrix M, whose last six columns should be multiplied by a constant c and the first three columns shall remain unchanged. What would be an appropriate way to achieve this?
Thank you very much for your help!
0 Kommentare
Akzeptierte Antwort
Star Strider
am 28 Jul. 2022
Another approach —
M = rand(5,9) % Shorter Version Of 'M'
c = 1000; % Create 'c'
Mnew = M.*[ones(1,3) ones(1,6)*c] % Multiply
.
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Elementary Math finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!