Osprey compatibility with MATLAB R2026a

Hi,

I just got a new PC and attempted to run Osprey (release 2.9.0) on the newest MATLAB version (R2026a). Unfortunately, I encountered multiple issues.

First, I usually saved the PDFs automatically. However, I got the following error message:

Error using validateHandleToPrint
UI components are not supported. To include UI components, use the 'exportapp' function.

Error in validate (line 17)
pj = validateHandleToPrint(pj);
     ^^^^^^^^^^^^^^^^^^^^^^^^^
Error in print (line 37)
pj = validate( pj );
     ^^^^^^^^^^^^^^
Error in saveas (line 140)
        print( h, name, ['-d' dev{i}] )
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in osp_plotModule (line 970)
saveas(out,fullfile(outputFolder,outputFile),'pdf');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in osp_plotAllPDF (line 37)
                osp_plotModule(MRSCont, 'OspreyLoad', kk,[1 1], 'metabolites');
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in OspreyLoad (line 444)
    osp_plotAllPDF(MRSCont, 'OspreyLoad')
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in osp_onLoad (line 35)
    MRSCont = OspreyLoad(MRSCont);
              ^^^^^^^^^^^^^^^^^^^



Error using matlab.ui.internal.controller.uicontrol.UIControlController/triggerActionEvent (line 76)
Error while evaluating UIControl Callback.

I then turned the auto-save option off in the load file and tried to save the PDF from the GUI. I received the following error message:

UI components are not supported. To include UI components, use the 'exportapp' function.

Error in validate (line 17)
pj = validateHandleToPrint(pj);
     ^^^^^^^^^^^^^^^^^^^^^^^^^
Error in print (line 37)
pj = validate( pj );
     ^^^^^^^^^^^^^^
Error in saveas (line 140)
        print( h, name, ['-d' dev{i}] )
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in osp_onPrint (line 1004)
saveas(out,fullfile(outputFolder,outputFile),'pdf');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Error using matlab.ui.internal.controller.uicontrol.UIControlController/triggerActionEvent (line 76)
Error while evaluating UIControl Callback.

I thought I’d try to continue with the processing of the data to see whether that works. Unfortunately, I got another error message there:

Error using  : 
Colon operands must be real scalars.

Error in OspreyProcess (line 783)
    for kk = 1 : MRSCont.nDatasets
               ^
Error in osp_onProc (line 37)
    MRSCont = OspreyProcess(MRSCont);
              ^^^^^^^^^^^^^^^^^^^^^^



Error using matlab.ui.internal.controller.uicontrol.UIControlController/triggerActionEvent (line 76)
Error while evaluating UIControl Callback.

Based on the error message, I assume this is a compatibility issue with newer MATLAB versions. Also because I had no problems with R2024b. I will download MATLAB R2024b, I’m sure that will work. :slight_smile:

Still, I thought it might be useful to mention this in the forum. Are there plans to adjust Osprey to be compatible with newer MATLAB versions?

Thanks and best,
Laura

Hi Laura,

Yes, MATLAB have completely changed the way their UI toolboxes work in MATLAB2026, and we have not had the resources yet to look at this. I cannot promise that we will be able to do this at this point, but I want to have a go at it for sure.

For now, sticking with 2024b should work, yes.

Thanks,
Georg