Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

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

1 visualizzazione (ultimi 30 giorni)
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 ?

Risposte (1)

Roger Stafford
Roger Stafford il 14 Apr 2017
p = 1:round(alpha*size(OldMatrix,1));
NewMatrix(p,:) = OldMatrix(p,:)+data;

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by