getting an error while using rest slice viewer ??

Error using sprintf Function is not defined for 'matlab.ui.Figure' inputs.
Error in rest_sliceviewer>InitControls (line 940) set(theFig, 'DeleteFcn', sprintf('rest_sliceviewer(''Delete'', %g);', theFig) );
Error in rest_sliceviewer (line 74) REST_SliceViewer_Cfg.Config(1+GetDisplayCount(REST_SliceViewer_Cfg)) =InitControls(AFilename, ACallback);
Error in rest_sliceviewer (line 38) rest_sliceviewer('ShowImage',''); %by Default, I show a black brain image
Error in rest (line 153) rest_sliceviewer,
Error using drawnow Error while evaluating UIControl Callback

Answers (1)

Rik
Rik on 2 Jan 2018
Edited: Rik on 2 Jan 2018
Apparently rest slice viewer was made for HG1 releases (which have numerical handles), and so is not compatible with HG2 releases (R2014b and newer).
This specific instance can be fixed by explicitly loading the number (which might have been turned off)
set(theFig, 'DeleteFcn', sprintf('rest_sliceviewer(''Delete'', %g);', get(theFig,'Number')) );
Edit: this change will keep the code compatible with prior releases, although there may be many other things you will have to change.

2 Comments

Thanks..but still it shows the same error
Really? Does it still say "Error using sprintf Function is not defined for 'matlab.ui.Figure' inputs." for this same line? I don't understand that, because it doesn't use the figure object as an argument for sprintf anymore. Have you close all instances of this function before retrying?

Sign in to comment.

Categories

Asked:

on 2 Jan 2018

Commented:

Rik
on 2 Jan 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!