Cody

Problem 43021. How many figures currently exist?

Solution 1044401

Submitted on 4 Nov 2016
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
assert(isequal(numfig(),0))

Assertion failed.

2   Fail
close all; figure; assert(isequal(numfig(),1))

Assertion failed.

  
3   Fail
close all; figure; figure; assert(isequal(numfig(),2))

Assertion failed.

  
  
4   Fail
close all; figure; figure; plot(1,1); figure; imagesc(magic(5)); assert(isequal(numfig(),3))

Assertion failed.

  
  
  
5   Fail
close all; n = randi(20); for ii=1:n figure; end assert(isequal(numfig(),n))

Assertion failed.

  
  
  
  
  
  
  
  
6   Fail
close all; assert(isequal(numfig(),0))

Assertion failed.

Suggested Problems

More from this Author44

Community Treasure Hunt

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

Start Hunting!