i am having matrix of i rows by 3 columns ,now i want to multiple only i rows of 1 columns with 5 upto 100th row after the 100th row ,values has to be as it is.
조회 수: 1 (최근 30일)
이전 댓글 표시
i= 3560 A = (i,3)
now want to multiple A(i,1) with some value say 5 but upto say 100 and then remaining values of rows has to be same.
and want to save New A(i,1) (change) with 1 to 100 i.e multiplied with 5 and remaining unchanged values in New A(i,1)
댓글 수: 0
채택된 답변
Manan Mishra
2018년 1월 11일
Let's assume that you want to multiply the first 'x' rows of the first column with a scalar 'n' and update the values in 'A'.
You can use the following command to do this:
>> A(1:x,1) = n*A(1:x,1);
If you want to do this for multiple columns (say first y columns) at once, you can do similar operation by indexing into columns also:
>> A(1:x,1:y) = n*A(1:x,1:y)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!