pdollar / toolbox

Piotr's Image & Video Matlab Toolbox
850 stars 499 forks source link

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

Open pkainz opened 8 years ago

pkainz commented 8 years ago

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