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].

답변 (1개)

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2019년 11월 1일

답변:

2019년 11월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by