-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess_ConcatenateDatFiles.m
More file actions
47 lines (42 loc) · 1.41 KB
/
Process_ConcatenateDatFiles.m
File metadata and controls
47 lines (42 loc) · 1.41 KB
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
function Process_ConcatenateDatFiles(recList,mergename)
% Concatenates dat files, cross-platform code
%
% USAGE
%
% Process_ConcatenateDatFiles(recList,mergename)
%
% recList a cell array of filebasenames (with or without '.dat' extenstion)
% mergename final concatenated file (if only one file in recList,
% the file is jsut renames)
%
% Dependencies: none
% Copyright (C) 2016 Adrien Peyrache
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
if ispc
cmdline = 'copy /B ';
if length(recList)>1
for ii=1:length(recList)-1
cmdline = [cmdline recList{ii} '.dat + '];
end
cmdline = [cmdline recList{end} '.dat ' mergename '.dat'];
else
cmdline = [cmdline recList{1} '.dat ' mergename '.dat'];
end
elseif isunix || ismac
if length(recList)>1
cmdline = 'cat ';
for ii=1:length(recList)-1
cmdline = [cmdline recList{ii} '.dat '];
end
cmdline = [cmdline recList{end} '.dat > ' mergename '.dat'];
else
cmdline = ['mv ' recList{1} '.dat ' mergename '.dat'];
end
else
error('Cannot determine the OS')
end
system(cmdline)