Running a MATLAB script from Notepad++

前端 未结 3 1293
野性不改
野性不改 2021-02-06 12:52

Is there a way of running a MATLAB script from Notepad++?

Obviously I have MATLAB installed on my computer. I know you can set a path for Notepad++to run when you hit F5

3条回答
  •  梦谈多话
    2021-02-06 13:43

    Use NppExec add-on and press F6, copy paste the following and save the script:

    NPP_SAVE
    set local MATPATH=C:\Program Files\MATLAB\R2015a\bin\matlab.exe
    
    cd "$(CURRENT_DIRECTORY)"
    
    "$(MATPATH)" -nodisplay -nosplash -nodesktop -r "try, run('$(FILE_NAME)'), 
     catch me, fprintf('%s / %s\n',me.identifier,me.message), end"
    

    then run (press F6; enter). Matlab Console and Plot windows still open and stay open. Error messages will be displayed in opening Matlab command window. Adding

    , exit"
    

    to the last command will make it quit and close again. If you want to run an automated application with crontabs or the like, check Matlab external interface reference for automation.

    matlab.exe -automation ...
    

    Also works in cmd terminal, but you have to fill in the paths yourself.

提交回复
热议问题