How to use nohup feature in MATLAB with Linux-based OS
57 次查看(过去 30 天)
显示 更早的评论
I have been curious to understand the usage of the nohup feature in MATLAB with a Linux-based OS. While I have attempted to find answers to my questions on the internet, the instructions provided by users can be quite confusing to follow. It would be greatly appreciated if someone could assist me in resolving the following queries.
- How to execute a MATLAB script file with nohup feature?
- How to know if the MATLAB script is being executed on nohup command?
- How to stop executing the MATLAB script midway, in case you start it by mistake?
Indeed, the queries and answers provided in this thread form a comprehensive guide for MATLAB users.
1 个评论
John Dzielski
2025-1-24,21:09
移动:Walter Roberson
about 9 hours 前
This isn't an answer, it's an ask. I'm running on Ubuntu 24.04. I normally work on a Mac and like to start Matlab from a command prompt. I try running the nohup <path to executable> &> /dev/null & and the splash screen flashes briefly, but the Matlab window never opens. A ps shows Matlab is running. If I try another GUI application like veracrypt, the wondow opens. The matlab command works without the nohup and it works if I run the symlink in /usr/local/bin/matlab.
Any idea why this might not be working on Ubuntu?
采纳的回答
Ashutosh
2023-8-22
Following are the responses to the queries which has been asked:
- To Execute a MATLAB script with "nohup" feature, first, open a terminal on your Linux machine. second, navigate to the directory where MATLAB script file is located and execute the below command in the terminal:
nohup matlab -nodisplay -nosplash -r "run('your_file.m'); exit" > output.log 2>&1 &
Replace 'your_file.m’ with the actual name of your file.
- To check whether the MATLAB script is being executed with the "nohup" command, use the "ps" command to list the running processes. Open a terminal and enter the following command:
ps aux | grep matlab
This will display the list of processes that include term matlab.
- To stop the execution of the script use "kill" command to stop the execution of the process with the process ID (PID) of it which is known by the previous command.
kill PID
5 个评论
Walter Roberson
2024-1-17
The
[1] 69286
indicates that process 69286 is waiting on I/O channel #1 (stdout).
You would get that message if you failed to redirect stdout.
John Dzielski
about 12 hours 前
I appreciate the comments, but these answers do not address the question. I want to start a normal Matlab interactive session. When you run w/o the nohup and do a ps after the session starts, there are 6 MATLABWebUI processes running. These processes don't start with the nohup.
What I see in the nohup.out file is the following repeated dozens of times:
>> Warning: "Error reading character from command line"
Bad file descriptor
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!