필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to multiply only some column and rows for a given number?!

조회 수: 1 (최근 30일)
Myke Ziz
Myke Ziz 2020년 1월 2일
마감: MATLAB Answer Bot 2021년 8월 20일
I want to multiply for 2.5 the all the rows (2 in total) but not the 1 column, how should I do?
Like this I litterally get rid of the column 1 after multiplying for 2.5.
scores = score(1:2,2:21).*(2.5)
Thank you for you help
Best

답변 (1개)

Fabio Freschi
Fabio Freschi 2020년 1월 2일
You are close to the answer, but you need to keep the first column
% your matrix with data
A = rand(2,21);
% multiply all but the first column
B = [A(:,1) A(:,2:end)*2.5];
  댓글 수: 2
Myke Ziz
Myke Ziz 2020년 1월 2일
Thank you a lot Fabio for your great answer it is clear now!!
Best regards
Z.M.
Fabio Freschi
Fabio Freschi 2020년 1월 2일
My pleasure! Please accept the answer if it solves your original problem
F

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by