This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
it_matlab_startup [2024/03/21 23:24] trinh created |
it_matlab_startup [2024/03/23 23:40] (current) trinh |
||
|---|---|---|---|
| Line 5: | Line 5: | ||
| Run this command to open the startup file | Run this command to open the startup file | ||
| - | | + | <code matlab> |
| + | edit(fullfile(userpath,' | ||
| - | % Example startup file | + | Once you have run the above, the relevant startup file should appear. You can copy and paste the below as a starter. Comment in or out the relevant scripts. |
| - | + | ||
| - | % This adds all paths recursively from the directory | + | <code matlab 1> |
| - | addpath(genpath(' | + | % Example startup file |
| - | % This adds a single path | + | |
| - | addpath ~/ | + | % This adds all paths recursively from the directory |
| - | + | % You can add the relevant directory where you store commonly used functions | |
| - | % Set figure default to something more pragmatic | + | % On windows, you may need to use a directory structure like C: |
| - | + | % addpath(genpath(' | |
| - | colordef white | + | |
| - | set(0, ' | + | % This adds a single path |
| - | + | % addpath ~/ | |
| - | set(0, ' | + | |
| - | | + | % Set figure default to something more pragmatic |
| - | | + | |
| - | + | colordef white | |
| - | + | set(0, ' | |
| - | set(0,' | + | |
| - | | + | set(0, ' |
| - | | + | ' |
| - | | + | ' |
| - | | + | |
| - | | + | |
| - | | + | set(0,' |
| - | + | ' | |
| - | clear | + | ' |
| - | close all | + | ' |
| - | + | ' | |
| - | % Add the starting path | + | ' |
| - | cd ~/ | + | ' |
| + | |||
| + | clear | ||
| + | close all | ||
| + | |||
| + | % Add the starting path | ||
| + | % cd ~/ | ||
| + | </ | ||
| + | |||
| + | You can try running the script. | ||
| + | |||
| + | If you exit Matlab and restart it, Matlab should run the startup script automatically. | ||
| + | |||
| + | The use of a startup file was common enough for me to make a guide on YouTube: | ||
| + | |||
| + | < | ||
| + | <iframe width=" | ||
| + | </ | ||