matlabuser-interfacematlab-deploymentmatlab-compiler

How do I fix bugs while executing matlab standalone applications?


Hello stackoverflow community,

I am currently trying to create a Matlab application as a standalone application. In Matlab, the program runs fine via the GUI, however, as soon as I install the application on my desktop and run it, I get the following error messages output to the command window:

  1. Error using dicom_getFileDetails (line 14) Unable to load file "RE.#_STR_IMG.REGISTRATION.dcm".
  2. Error in dicominfo (line 55)
  3. Error in Apply_Registration/ApplyRegistrationButtonPushed (line 64)
  4. Error in appdesigner.internal.service.AppManagementService/tryCallback (line 333)
  5. Error in matlab.apps.AppBase>@(source,event)tryCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 35)
  6. Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335) Error while evaluating button PrivateButtonPushedFcn.

Code: 1+2)

    % Button pushed function: OpenRegistrationFileButton
      function OpenRegistrationFileButtonPushed(app, event)
        
        % Open registration file
        app.File_registrationFile = uigetfile;
      end
  1.  reginfo = dicominfo(app.File_registrationFile);
    

What is the problem when running as a standalone application?

The Matlab Runtime Compiler matches my Matlab version. Unfortunately, I lack the expertise to move forward here.

Any help will be greatly appreciated!


Solution

  • You are currently only outputting the file name from uigetfile (docs), so subsequent usage of that file assume it's in the same folder as the executing app. This is likely not the case, hence the error that the file can't be loaded (because it doesn't exist).

    You just need to be more explicit, get the path too and refer to the full file path instead of just the name

    [file,path] = uigetfile;
    app.File_registrationFile = fullfile( path, file );