필터 지우기
필터 지우기

How to multiply some columns in matrix by scalar

조회 수: 2 (최근 30일)
Emma Kuttler
Emma Kuttler 2022년 3월 25일
편집: David Hill 2022년 3월 25일
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

답변 (1개)

David Hill
David Hill 2022년 3월 25일
편집: David Hill 2022년 3월 25일
railwayarcsBIG=railwayarcs;
railwayarcsBIG(:,3:12)=railwayarcsBIG(:,3:12)*100;

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by