Errors in Matlab 2015a, sprintf()

52 views
Skip to first unread message

Logan Dowdle

unread,
Oct 7, 2015, 4:17:47 PM10/7/15
to GLMdenoise
When attempting to run GLMdenoise, using the standard call provided on the website:

[results,denoiseddata] = GLMdenoisedata(design,data,stimdur,tr,[],[],[],'figures');

Matlab returns the following error:

  Error using sprintf
  Function is not defined for 'matlab.ui.Figure' inputs.

Which appears to be pointing at this code in printnice.m, specifically line 77.  

0077     filename = sprintf([prefix '.png'],fig);
0078     print(fig,'-dpng',['-r' num2str(mode(2))],filename);  % painters, zbuffer, opengl???  what is correct?


This appears to be caused by changes in how newer versions of MatLab handle sprintf(). See: http://blogs.mathworks.com/loren/2014/11/05/matlab-r2014b-graphics-part-3-compatibility-considerations-in-the-new-graphics-system/

Is there a simple fix I can make in the code or a planned fix for this change?

Thanks,

Logan

Kendrick Kay

unread,
Oct 7, 2015, 10:41:32 PM10/7/15
to Logan Dowdle, GLMdenoise
> 0077 filename = sprintf([prefix '.png'],fig);
> 0078 print(fig,'-dpng',['-r' num2str(mode(2))],filename); % painters, zbuffer, opengl??? what is correct?


Hi.

Annoying matlab issue.

For a quick hack, try:

filename = sprintf([prefix '.png'],fig);
==>
filename = sprintf([prefix '.png'],get(fig,'Number'));


Does that work?

Logan Dowdle

unread,
Oct 8, 2015, 2:10:52 PM10/8/15
to GLMdenoise, logan....@gmail.com, k...@umn.edu
Yes - that resolves the problem completely. Thanks for the quick response. 

Logan
Reply all
Reply to author
Forward
0 new messages