- OS: e.g. Linux Mint 20.1
- Octave version: Version 6.1.0
- Installation method: Built and installed from source code
I submitted a bug report complaining that g=figure(5) works as expected while g=figure 5 throws an error. The “bug” was closed and I received the following response:
This is expected behavior. Calling
figure 6is equivalent to
Using the command syntax might set the
ansvariable (if the command has an
output argument). But it cannot be used in assignments. Use the function syntax instead:
h = figure(7).
Well, okay. That creates at least two other problems.
The documentation for the figure function explicitly states, “Figure numbers must be positive integers.” Therefore, figure(“6”) should error; isnumeric “6” ==> false.
The Octave manual, section 11.13 Commands, states, “Commands are a special class of functions that only accept string input arguments.” This conflicts with the idea of using command syntax with the figure function because as stated above, figure() requires a numeric, not string, argument.
Per the manual, h=figure 5 is equivalent to h=figure(“5”); therefore, for the latter to work while the former errors demonstrates non-equivalence.