Skip to content

savefig shadowing MATLAB >= 2013b built-in function #14

Description

@pkainz

Hi,

as of MATLAB 2013b savefig was introduced as a built-in function. Now when adding the toolbox to the path, the function defined in

toolbox/external/other/savefig.m

shadows the MATLAB builtin function defined in

matlab/8.2/x86_64/toolbox/matlab/graphics/savefig.p 

such that the standard MATLAB command

saveas(handle, 'filename', 'fig')

tries to access the toolbox command instead of the 'new' built-in backend function for saving figures.
Since the function signatures differ, this results in the following error

Error using savefig (line 128)
No file name specified.

Error in saveasfig (line 7)
savefig(h, name);

Error in saveas (line 141)
    feval( ['saveas' format], h, name )

Error in evaluate_template_stage_1_debug (line 389)
        saveas(myPlot, 'filename', 'fig');

I think this is a compatibility issue, since everything works as expected on 2013a.
A temporary workaround for me is now to rename the savefig function in the toolbox to get rid of the shadowing, because as far as I know I am not using it from other toolbox functions. However, this would inevitably break some other functions in the toolbox, that depend on savefig.

Maybe renaming it in the toolbox and fixing the internal function calls is a permanent solution to that problem.

Cheers,
Phil

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions