Start application from Matlab

前端 未结 3 2022
盖世英雄少女心
盖世英雄少女心 2020-12-17 19:53

I\'m looking for a way to start an application from within Matlab. The thing is, my Matlab script saves some results to a file, which should then be opened in the associated

3条回答
  •  伪装坚强ぢ
    2020-12-17 20:23

    As I indicated in my Edit above, this could be a solution:

    % Save library paths
    MatlabPath = getenv('LD_LIBRARY_PATH');
    % Make Matlab use system libraries
    setenv('LD_LIBRARY_PATH',getenv('PATH'))
    disp('Starting Blender...')
    system( ['blender ', Directory, FileName, '.blend'] )
    % Reassign old library paths
    setenv('LD_LIBRARY_PATH',MatlabPath)
    

    However, with the other way to start an application, you can immediately return to Matlab after starting it:

    % Start Blender and immediately return to Matlab
    !blender Geometry.blend &
    

    The ampersand (&) is the key to immediately return to Matlab after starting the application , but starting Blender this way I cannot provide a variable FileName like I can do with system(...).

    So, anybody got a clue on how to

    • use !program_name with a variable filename

      or

    • use system(program_name) with an option such that Matlab just starts the application (and doesn't wait with returning until the application has been closed)

提交回复
热议问题