Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set some custom variables on Matlab startup

Tags:

matlab

I would like to set some initial variables (like format compact and the current directory) automatically on each startup of Matlab.
How can I do that?

like image 234
bastibe Avatar asked Oct 18 '08 00:10

bastibe


People also ask

How do I change the startup file in MATLAB?

Startup Options in MATLAB Startup File m file in a folder on the MATLAB search path. Use startup. m to modify the default search path, predefine variables in your workspace, or define defaults for graphics objects.

Where is Startup M file MATLAB?

startup executes user-specified commands when starting MATLAB®. Create a startup. m file in the userpath folder, which is on the MATLAB search path.

What is MATLAB Startup Accelerator?

When you install MathWorks® products on your computer, the installation includes a utility program that can speed up MATLAB® startup, called the MATLAB Startup Accelerator. By default, the installer configures this utility as a scheduled task on your computer that runs several times each day.

How do I set the path of a file in MATLAB?

On the Home tab, in the Environment section, click Set Path. The Set Path dialog box appears. Alternatively, you can access this dialog box using the pathtool function. Use the Add Folder or Add Folder with Subfolders button to add new folders to MATLAB search path.


2 Answers

Create a startup.m script file containing the commands to set up the state that you want. Next, from inside MATLAB, run the command

>> userpath

This will give you a list of one or more user-specific directories (depending on what OS you are using); put your startup.m in any of those directories and it will be found whenever you start MATLAB (startup.m is also found if it is in the directory from which MATLAB is started, but the technique above allows you to start MATLAB from an arbitrary directory and still have startup.m get run).

like image 124
SCFrench Avatar answered Oct 02 '22 12:10

SCFrench


Create a startup.m file in the directory that you launch matlab from.

like image 23
Mr Fooz Avatar answered Oct 02 '22 11:10

Mr Fooz