How to get a program to display something from a function?

 Accepted Answer

Remove the semicolon at the end of
counter = counter + 1
The value of 'counter' will then display every time it's updated.
A more visually appealing method is to use fprintf
count = counter + 1;
fprintf('count = %d\n', count);

More Answers (0)

Categories

Asked:

on 21 Sep 2018

Edited:

on 21 Sep 2018

Community Treasure Hunt

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

Start Hunting!