Effacer les filtres
Effacer les filtres

How to multiply some columns in matrix by scalar

2 vues (au cours des 30 derniers jours)
Emma Kuttler
Emma Kuttler le 25 Mar 2022
Modifié(e) : David Hill le 25 Mar 2022
I have a matrix with 12 columns. I want to multiply all columns except the first two by 100 and leave the first two the same, then output all this into a new matrix. How do i do this?
railwayarcsBIG = railwayarcs(:,2:12)*100;
% this code does not return the first two columns, it eliminates them and
% only does the scalar multiplication

Réponses (1)

David Hill
David Hill le 25 Mar 2022
Modifié(e) : David Hill le 25 Mar 2022
railwayarcsBIG=railwayarcs;
railwayarcsBIG(:,3:12)=railwayarcsBIG(:,3:12)*100;

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by