Need help using the for loop
5 次查看(过去 30 天)
显示 更早的评论

Test case
Check if AdjustMinValue(4, [2, 12, 9, 20], 10) returns [4, 12, 18, 20]
0 个评论
回答(1 个)
David Hill
2019-10-22
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!