Info

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

Creating a parameter which indicates adding values to only part of the elements in a Matrix?

조회 수: 1 (최근 30일)
alpha represents the proportion of elements in OldMatrix can be from 0 to 1.
How can I create a create a parameter like alpha that indicates that I only only want to add an integer like data to only a proportion of the elements in matrix such as OldMatrix ?

답변 (1개)

Roger Stafford
Roger Stafford 2017년 4월 14일
p = 1:round(alpha*size(OldMatrix,1));
NewMatrix(p,:) = OldMatrix(p,:)+data;

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

Community Treasure Hunt

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

Start Hunting!

Translated by