matlab:matlab_helpful_hacks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
matlab:matlab_helpful_hacks [2015/08/15 17:46] – igorkagan | matlab:matlab_helpful_hacks [2019/07/10 11:46] – igorkagan | ||
---|---|---|---|
Line 10: | Line 10: | ||
x = {1, | x = {1, | ||
- | ==== startup.m ==== | ||
- | When MATLAB starts, it looks for a pathdef.m file in its startup directory. | + | ==== Exiting loop (for / while -> pause) gracefully ==== |
+ | (i.e., without " | ||
- | Start up folder | + | For example, when paging thru trials: |
+ | <code matlab> | ||
+ | figure(' | ||
+ | for k = 1:length(trial), | ||
+ | ... | ||
+ | drawnow; pause; | ||
+ | if get(gcf,' | ||
+ | break; | ||
+ | end | ||
+ | clf; | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Finding indices between two vectors of start and end indices, using arrayfun ==== | ||
+ | |||
+ | Assume we have two vectors, repeated_segments_start_idx, | ||
<code matlab> | <code matlab> | ||
- | disp(' | + | idx = [repeated_segments_start_idx(segments2remove_idx): |
- | set_sources_path; | + | |
- | % addpath(genpath(' | + | |
- | cd(' | + | idx = cell2mat(arrayfun(@colon, |
- | edit; | + | |
- | EditorMacro('Alt-Control-h', | + | |
- | dbstop if error | ||
</ | </ | ||
+ | |||
+ | ==== Maximize figure window ==== | ||
+ | <code matlab> | ||
+ | |||
+ | |||
+ | |||
+ | ==== Plot an '' | ||
+ | |||
+ | <code matlab> | ||
+ | h = imagesc(X, | ||
+ | set(h,' | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Shifting colormaps ==== | ||
+ | Sometimes the colormap plots are shifted after printing. To fix this: | ||
+ | - in Adobe Illustrator, | ||
+ | |||
+ | You have to do it for each of the colormaps. | ||
matlab/matlab_helpful_hacks.txt · Last modified: 2022/12/29 07:15 by 127.0.0.1