Need help using the for loop

5 views (last 30 days)
Jose Grimaldo
Jose Grimaldo on 21 Oct 2019
Commented: David Hill on 22 Oct 2019
Test case
Check if AdjustMinValue(4, [2, 12, 9, 20], 10) returns [4, 12, 18, 20]

Answers (1)

David Hill
David Hill on 22 Oct 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

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!