File: tsgCopyGrid.m

package info (click to toggle)
tasmanian 8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,852 kB
  • sloc: cpp: 34,523; python: 7,039; f90: 5,080; makefile: 224; sh: 64; ansic: 8
file content (40 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download | duplicates (3)
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
function  [lNewGrid] = tsgCopyGrid(lOldGrid, sNewGridName)
%
% [lNewGrid] = tsgCopyGrid(lOldGrid, sNewGridName)
%
%  Makes a physical copy of a grid that differs only in the name
%  Note: tsgCopyGrid will create a new grid file in the work folder, while
%  the command lNewGrid = lOldGrid will only create an alias
%
% INPUT:
%
% lGrid: a grid list created by tsgMake***(...)
%
% sNewGridName: the name for the new grid, the new grid will be identical
% to the old one in every other way
%
% OUTPUT:
%
% lNewGrid: a grid object pointing to the physical copy of the old grid
%

[sFiles, sTasGrid] = tsgGetPaths();
[sFileG, sFileX, sFileV, sFileO, sFileW, sFileC] = tsgMakeFilenames(lOldGrid);

lNewGrid = lOldGrid;
lNewGrid.sName = sNewGridName;
if isfield(lNewGrid, 'sFilename')
    lNewGrid.sFilename = tsgMakeGridFilename(sNewGridName);
end
[sFileGNew, sFileX, sFileV, sFileO, sFileW, sFileC, sFileL] = tsgMakeFilenames(lNewGrid);

sFileG    = regexprep(sFileG, '\\ ', ' ');
sFileGNew = regexprep(sFileGNew, '\\ ', ' ');
[status, cmdout] = copyfile(sFileG, sFileGNew);

if (~isempty(cmdout))
    fprintf(1,['WARNING: Command had non-empty output:\n']);
    disp(cmdout);
end

end