Need help using the for loop

1 visualización (últimos 30 días)
Jose Grimaldo
Jose Grimaldo el 21 de Oct. de 2019
Comentada: David Hill el 22 de Oct. de 2019
Test case
Check if AdjustMinValue(4, [2, 12, 9, 20], 10) returns [4, 12, 18, 20]

Respuestas (1)

David Hill
David Hill el 22 de Oct. de 2019
Not sure why you have to use a for-loop.
function dataSamples = adjustMinValue(dataSamples,minValue)
for i=1:length(dataSamples)
if dataSamples(i)<minValue
dataSamples(i)=2*dataSamples(i);
end
end
  2 comentarios
Jose Grimaldo
Jose Grimaldo el 22 de Oct. de 2019
Code did not work
David Hill
David Hill el 22 de Oct. de 2019
Works for me!

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by