Create a function without inputs that adds one to the output every time it is called.
a = counterfun; disp(a) >> 1 a = counterfun; disp(a) >> 2 % etc.
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers28
Suggested Problems
-
Increment a number, given its digits
688 Solvers
-
Return elements unique to either input
815 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
14226 Solvers
-
784 Solvers
-
Find index of a string in a cell array
40 Solvers
More from this Author14
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!