Trinh @ Bath

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
it_matlab_startup [2024/03/23 23:20]
trinh
it_matlab_startup [2024/03/23 23:35]
trinh
Line 6: Line 6:
  
 <code matlab> <code matlab>
-edit(fullfile(userpath,'startup.m')) +edit(fullfile(userpath,'startup.m')) </code>
- </code>+
  
  
- % 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('~/myfunctions')); +% Example startup file  
- % This adds a single path + 
- addpath ~/mysinglepath/ +% 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:\Users\myuserid\Documents\... 
-  +addpath(genpath('~/myfunctions')); 
- colordef white + 
- set(0, 'Units', 'pixels'); +% This adds a single path 
-  +addpath ~/mysinglepath/ 
- set(0, 'defaultaxesfontsize', 18, 'defaultaxeslinewidth', 1, ... + 
-         'defaultlinelinewidth', 1, 'defaultpatchlinewidth', .7, ... +% Set figure default to something more pragmatic 
-         'defaultAxesFontSize', 18); + 
-  +colordef white 
-  +set(0, 'Units', 'pixels'); 
- set(0,'DefaultFigureColor','w', ... + 
-       'DefaultAxesColor','w',... +set(0, 'defaultaxesfontsize', 18, 'defaultaxeslinewidth', 1, ... 
-       'DefaultAxesXColor','k',... + 'defaultlinelinewidth', 1, 'defaultpatchlinewidth', .7, ... 
-       'DefaultAxesYColor','k',... + 'defaultAxesFontSize', 18); 
-       'DefaultAxesZColor','k',... + 
-       'DefaultTextColor','k',... + 
-       'DefaultLineColor','k'); +set(0,'DefaultFigureColor','w', ... 
-  + 'DefaultAxesColor','w',... 
- clear + 'DefaultAxesXColor','k',... 
- close all + 'DefaultAxesYColor','k',... 
-  + 'DefaultAxesZColor','k',... 
- % Add the starting path + 'DefaultTextColor','k',... 
- cd ~/mystartingpath/+ 'DefaultLineColor','k'); 
 + 
 +clear 
 +close all 
 + 
 +% Add the starting path 
 +cd ~/mystartingpath/ 
 +</code> 
 + 
 +You can try running the script.  
 + 
 +If you exit Matlab and restart it, Matlab should run the startup script automatically.