Open MATLAB path document in linux terminal

조회 수: 21 (최근 30일)
Tongyao
Tongyao 2023년 8월 31일
답변: Yash 2023년 9월 1일
Basically I want something similar to matlab's `open some_script.m` command but in a terminal without launching matlab (not even matlab -nonsplash because it still takes time)
Why I want to do this? I use vscode to type my scripts, and sometimes I need to check the content of some functions in my matlab path. I am curious if there is some quick way to do this.
Please let me know if you need more clarification. Thanks!

답변 (1개)

Yash
Yash 2023년 9월 1일
If you want to quickly view the content of MATLAB script files (.m) in your terminal without launching MATLAB, you can navigate to your MATLAB path by using the cd command and to view the scripts you can use various command-line text editors or viewers in linux. Here are a few options:
  1. cat Command: You can use the cat command to display the content of MATLAB script files in your terminal.
cat some_script.m
This will display the content of some_script.m directly in the terminal.
  • less Command: The less command allows you to view the content of a file one screen at a time. To view a MATLAB script
less some_script.m
You can scroll through the file using the arrow keys and exit by pressing q.
  • more Command: Similar to less, the more command lets you view files page by page
more some_script.m
This will display the content of some_script.m in the terminal.
  • vim Command: The most basic text editor available on linux platform.
vim some_script.m
Using these commands, you can quickly check the content of MATLAB script files without launching MATLAB or using any GUI-based editors. This should work well with VS Code, as you can open your terminal directly within VS Code and use these commands there.
I hope this helps.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by