Cody

# Problem 43021. How many figures currently exist?

Solution 1150969

Submitted on 31 Mar 2017
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))

y = Figure (1) with properties: Number: 1 Name: '' Color: [1 1 1] Position: [508 656 583 437] Units: 'pixels' Show all properties

Undefined function 'minus' for input arguments of type 'matlab.ui.Figure'. Error in numfig (line 3) y=y-1; Error in TestPoint1 (line 1) assert(isequal(numfig(),0))

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

y = Figure (2) with properties: Number: 2 Name: '' Color: [1 1 1] Position: [508 656 583 437] Units: 'pixels' Show all properties

Undefined function 'minus' for input arguments of type 'matlab.ui.Figure'. Error in numfig (line 3) y=y-1; Error in TestPoint2 (line 3) assert(isequal(numfig(),1))

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

y = Figure (3) with properties: Number: 3 Name: '' Color: [1 1 1] Position: [508 656 583 437] Units: 'pixels' Show all properties

Undefined function 'minus' for input arguments of type 'matlab.ui.Figure'. Error in numfig (line 3) y=y-1; Error in TestPoint3 (line 4) assert(isequal(numfig(),2))

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

y = Figure (4) with properties: Number: 4 Name: '' Color: [1 1 1] Position: [508 656 583 437] Units: 'pixels' Show all properties

Undefined function 'minus' for input arguments of type 'matlab.ui.Figure'. Error in numfig (line 3) y=y-1; Error in TestPoint4 (line 5) assert(isequal(numfig(),3))

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

y = Figure (15) with properties: Number: 15 Name: '' Color: [1 1 1] Position: [508 656 583 437] Units: 'pixels' Show all properties

Undefined function 'minus' for input arguments of type 'matlab.ui.Figure'. Error in numfig (line 3) y=y-1; Error in TestPoint5 (line 6) assert(isequal(numfig(),n))

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

y = Figure (1) with properties: Number: 1 Name: '' Color: [1 1 1] Position: [508 656 583 437] Units: 'pixels' Show all properties

Undefined function 'minus' for input arguments of type 'matlab.ui.Figure'. Error in numfig (line 3) y=y-1; Error in TestPoint6 (line 2) assert(isequal(numfig(),0))