You initialize nback in get_defaults through a simple assignment. Except in special constructions, that would be an assignment to a plain workspace variable, and plain workspace variables are removed when the function returns. A plain assignment to a variable within a function never creates a new variable within the context of a calling function.
get_defaults is called within a settings function, so after get_defaults is executed inside the settings function, the variables assigned to inside that function do not exist inside the setting function, and certainly they do not also get copied up to the function that calls the settings function.
The "special construction" that I mentioned before:
If you have an outer function that assigns to a variable, and then syntactically after the variable has been assigned to, the outer function defines a second function inside the outer function (without terminating the outer function!), then when the inner function is called, the inner function can read and write the variable, and the change will be seen in the outer function and any inside functions. For example if you had
nback = -1;
nback = 2;
brolly = 3;
brolly = -2;
Only variables assigned to before the inner function is defined are treated as shared, so brolly is not shared but nback is shared.
Now... back when shared variables were introduced, matlab treated them as shared if they were assigned to before the nested function was called. At the time get_defaults is called, brolly has been assigned to, and matlab said that was good enough to treat it as shared; after a few releases it was changed to require initialization before the sharing function is defined.
I do not recall at the moment when the change was made. My memory is suggesting r2008b, but it could have been r2010a... it would have to be researched.
But it would not matter for your purposes because your code does not assign to nback before the settings routine is called either.
What does it mean in practice:
Notice the section that talks about initializing global variables. Add an assignment to nback there. Any value is fine including .
You will need to look through the rest of the variables set in get_defaults and assign to them in the same section, such as the background color scheme variable.