-
Notifications
You must be signed in to change notification settings - Fork 1
/
clipclip.m
52 lines (40 loc) · 1.42 KB
/
clipclip.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function clipclip(figH, tSize, fFormat, boundingBox)
%CLIPCLIP (tools): copy current figure to a snapshot on disk for ppt etc.
% clipclip(figH, tSize, fFormat)
%
% export path is hardcoded below
%
% notes: figures with transparency don't work with this, printing
% doesn't work (matlab bug). Use clipclippix to grab a screenshot.
%
% See also CLIPCLIPPIX
%
% MH - http://github.com/histed/tools-mh
if nargin < 1 || isempty(figH), figH = gcf; end
if nargin < 2 || isempty(tSize), tSize = 6*[1 0.75]; end
if nargin < 3 || isempty(fFormat), fFormat = 'pdf'; end
%% set paths
% file export path
%fPath = '~/shared/snapshots';
%fPath = 'i:/users/histed/snapshots';
dirs = directories;
assert(isfield(dirs, 'toolsSnapshots'), ....
'needed dir entry is missing, edit directories.m');
nFigs = length(figH);
allNameC = {};
for iFig = 1:nFigs
tFig = figH(iFig);
fName = [mfilename '-' datestr(now, 'yymmdd-HHMM_SS_FFF')];
allNameC{iFig} = fName;
fullF = fullfileMH(dirs.toolsSnapshots, fName);
exportfig_print(tFig, fullF, ...
'FileFormat', fFormat, ...
'Size', tSize, ...
'Renderer', 'painters');
end
if length(allNameC) > 1
if any(strcmp(allNameC{1}, allNameC(2:end)))
error('clipclip working too fast, need to change filename to avoid collison');
end
end
%unix(sprintf('convert %s %s', [fullF '.png'], [fullF '.wmf']));