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/09/13 22:09] – 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. | ||
- | |||
- | Start up folder (in the icon | Properties | Start in ) (e.g. D: | ||
- | |||
- | <code matlab> | ||
- | disp(' | ||
- | set_sources_path; | ||
- | % addpath(genpath(' | ||
- | |||
- | cd(' | ||
- | edit; | ||
- | EditorMacro(' | ||
- | |||
- | dbstop if error | ||
- | </ | ||
==== Exiting loop (for / while -> pause) gracefully ==== | ==== Exiting loop (for / while -> pause) gracefully ==== | ||
Line 37: | Line 20: | ||
... | ... | ||
drawnow; pause; | drawnow; pause; | ||
- | if get(gcf,' | + | if get(gcf,' |
break; | break; | ||
end | end | ||
Line 45: | Line 28: | ||
+ | ==== Finding indices between two vectors of start and end indices, using arrayfun ==== | ||
+ | |||
+ | Assume we have two vectors, repeated_segments_start_idx, | ||
+ | |||
+ | <code matlab> | ||
+ | idx = [repeated_segments_start_idx(segments2remove_idx): | ||
+ | |||
+ | idx = cell2mat(arrayfun(@colon, | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ==== 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