How i can open matlab file from terminal to edit it?

조회 수: 111 (최근 30일)
mohammed mahmoud
mohammed mahmoud 2017년 12월 7일
댓글: Steven Lord 2019년 7월 18일
I run my file on gpu and when, write "type file name" command it open the file but no editing so, how can i edit the file?
  댓글 수: 2
Jan
Jan 2017년 12월 7일
편집: Jan 2017년 12월 7일
What does "running a file on gpu" mean? Where do you write "type file name" and what do you expect as result? Where does the file open and what kind of "Matlab file" are you talking of - an M-file? What kind of "terminal" do you mean.
Please explain the details more clearly.
mohammed mahmoud
mohammed mahmoud 2017년 12월 7일
편집: mohammed mahmoud 2017년 12월 7일
i use Putty program to access gpu server, i don't able to see desktop

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2017년 12월 7일
You can open an M-file in Matlab by typing
edit File.m
If it is not in the current path add the path name also. Alternatively you can click on the "Open" button in the menu. A double click on the M-file opens it in the editor also.
But see my questions for clarifications in the comment above.
  댓글 수: 8
Andrew Landau
Andrew Landau 2019년 7월 18일
Related question:
Let's say you want to open a .m file in textedit from a bash terminal. You'd write:
open -a "TextEdit" scriptName.m
Now, let's say you were working in terminal and wanted to open a script in matlab when matlab isn't open. I tried:
open -a "Matlab" scriptName.m
As well as "MATLAB" and "matlab", but both did not work.
Ideally, one could write a command that opens matlab, makes the current folder of matlab the same path as the current terminal directory, then opens a specified file in editor.
Thanks for your help.
Steven Lord
Steven Lord 2019년 7월 18일
When you start MATLAB, specify the -sd startup option to control where MATLAB starts and specify the -r option to run the command "edit(nameOfFile)" replacing nameOfFile with the file you want to open.
While I've linked the Linux startup options list above, Windows and Mac OS also support both those options. See the other pages linked in the See Also from the page above for OS-specific startup options (mainly the COM-related options on Windows, I believe.)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by