Write a for loop that iterates from 1 to numberSamples to double any element's value in dataSamples that is less than minValue. Ex: If minVal = 10, then dataSamples = [2, 12, 9, 20] becomes [4, 12, 18, 20].

11 vues (au cours des 30 derniers jours)
Any help with this problem would be great!

Réponses (1)

galaxy
galaxy le 1 Nov 2019
Let's try
minVal = 10;
dataSamples = [2, 12, 9, 20];
dataSamples(find(dataSamples <= minVal)) = dataSamples(find(dataSamples <= minVal)) * 2;

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by