## Making use of figure numbers is discouraged – what are your workarounds?

Quite a common task, I assume: based on a simulation or measurement run I generate a set of figures to display the results.

I find it convenient to group the figure numbers of a single run in a certain number range, say 1XXX or 2XXX. In this way I can compare specific results of different runs by quickly picking the windows of two figures, say 1003 and 2003.

But Matlab obviously discourages the use of figure numbers. As far as I know

figure(n, Name="Foo") or figure(Number=n, Name="Foo") is not supported, you need two lines

loading a .fig-file into a figure with a certain number is not supported

reassigning a figure number is not supported, the number is read-only

duplicating figures is not natively supported (why?), the copyobj workaround comes with too many limitations

Are there any workarounds to go on with figure numbers that I’m not aware of?

When you create a new figure, Matlab knows what figure number n to choose: the smallest positive integer that is not occupied by an existing figure. Can you somehow manipulate that n, except for creating dummy figures ;-)?

Or what is your trick of dealing with this common task? Prepend a number string to the figure name? The figure window name will read something like "Figure 23: 1003 Foo" – ugly.

Or am I missing something? Is there any usability rationale behind discouraging figure numbers, or is it just a long-standing limitation?Quite a common task, I assume: based on a simulation or measurement run I generate a set of figures to display the results.

I find it convenient to group the figure numbers of a single run in a certain number range, say 1XXX or 2XXX. In this way I can compare specific results of different runs by quickly picking the windows of two figures, say 1003 and 2003.

But Matlab obviously discourages the use of figure numbers. As far as I know

figure(n, Name="Foo") or figure(Number=n, Name="Foo") is not supported, you need two lines

loading a .fig-file into a figure with a certain number is not supported

reassigning a figure number is not supported, the number is read-only

duplicating figures is not natively supported (why?), the copyobj workaround comes with too many limitations

Are there any workarounds to go on with figure numbers that I’m not aware of?

When you create a new figure, Matlab knows what figure number n to choose: the smallest positive integer that is not occupied by an existing figure. Can you somehow manipulate that n, except for creating dummy figures ;-)?

Or what is your trick of dealing with this common task? Prepend a number string to the figure name? The figure window name will read something like "Figure 23: 1003 Foo" – ugly.

Or am I missing something? Is there any usability rationale behind discouraging figure numbers, or is it just a long-standing limitation? Quite a common task, I assume: based on a simulation or measurement run I generate a set of figures to display the results.

I find it convenient to group the figure numbers of a single run in a certain number range, say 1XXX or 2XXX. In this way I can compare specific results of different runs by quickly picking the windows of two figures, say 1003 and 2003.

But Matlab obviously discourages the use of figure numbers. As far as I know

figure(n, Name="Foo") or figure(Number=n, Name="Foo") is not supported, you need two lines

loading a .fig-file into a figure with a certain number is not supported

reassigning a figure number is not supported, the number is read-only

duplicating figures is not natively supported (why?), the copyobj workaround comes with too many limitations

Are there any workarounds to go on with figure numbers that I’m not aware of?

When you create a new figure, Matlab knows what figure number n to choose: the smallest positive integer that is not occupied by an existing figure. Can you somehow manipulate that n, except for creating dummy figures ;-)?

Or what is your trick of dealing with this common task? Prepend a number string to the figure name? The figure window name will read something like "Figure 23: 1003 Foo" – ugly.

Or am I missing something? Is there any usability rationale behind discouraging figure numbers, or is it just a long-standing limitation? figure, figure number, figure handle, plotting MATLAB Answers — New Questions