Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ACrWVE 2.3.3: Double colon operator: Counting down. This tool is provided by a t

ID: 3888240 • Letter: A

Question

ACrWVE 2.3.3: Double colon operator: Counting down. This tool is provided by a third party Your activity is aways recorded but you may need to refresh the page to fill in the banner Double colon operator: Counting down Construct a row array countValues from startValue to endValue, elements decremented by -2 end Ex: lf startvalue is 10 and end alue iso,courtValues should be[10, 8, 6, 4, 2, 01. Your Function a Save C Reset MATLAB Documentation 1: function countValues = CreateArray (startValue, endValue) 2 s startVatue: Starting value of array % endValue: Ending value of array % construct a row array countvalues from startvalue 6 to endValue, elements decremented by -2 countValues = 0; L9 end Code to call your function C Reset 1 CreateArray (10, 0)

Explanation / Answer

% function that takes 2 parameters
function countValues = CreateArray(startValue, endValue)
    % initializing index to 1
    ind = 1;
    % as longs as start value is greater than end value
    % will append it to array and reduce stat value by 2
    while (startValue>=endValue)
        countValues(ind) = startValue;
        ind = ind+1;
        startValue = startValue -2;
    end
end

% sample run
disp(CreateArray(10,0));

Sample Output

10    8    6    4    2    0

% function that takes 2 parameters
function countValues = CreateArray(startValue, endValue)
    % initializing index to 1
    ind = 1;
    % as longs as start value is greater than end value
    % will append it to array and reduce stat value by 2
    while (startValue>=endValue)
        countValues(ind) = startValue;
        ind = ind+1;
        startValue = startValue -2;
    end
end

% sample run
disp(CreateArray(10,0));

Sample Output

10    8    6    4    2    0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote