Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

Write a matlab function for making a step-down counter from 10 to 1

  1. User

    Write a matlab function for making a step-down counter from 10 to 1

  2. Assistant

    Here's a MATLAB function that creates a step-down counter from 10 to 1:

    function stepDownCounter()
    
        % Starting value of the counter
        counter = 10;
        
        % Loop to count down from 10 to 1
        while counter >= 1
            disp(counter);
            counter = counter - 1;
        end
    
    end
    

    To run this function, you can simply call stepDownCounter(). It will display the numbers from 10 to 1, each on a new line.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.