Revision 495
(checked in by cbc, 12 years ago)
|
Initial import of Stark code.
|
Line | |
---|
1 |
|
---|
2 |
% LOADZ loads a compressed file (.Z extension) from data |
---|
3 |
% without having to create alternate directories |
---|
4 |
% |
---|
5 |
% LOADZ is not yet modified for returning outputs |
---|
6 |
% (e.g., [data, time]=loadZ(filename); ) |
---|
7 |
% |
---|
8 |
% compressed_filename='/mastiff/data/ioeb97b/unpack/gdb1.dat.Z'; |
---|
9 |
% loadZ; |
---|
10 |
% |
---|
11 |
% Catherine R. Edwards |
---|
12 |
% Last modified: 2 Jun 1999 |
---|
13 |
|
---|
14 |
% check to make sure input filename has a .Z extension |
---|
15 |
|
---|
16 |
len=length(compressed_filename); |
---|
17 |
tag=compressed_filename(len-1:len); |
---|
18 |
|
---|
19 |
if strcmp(tag,'.Z')==0 |
---|
20 |
disp('Input file must have a compressed extension') |
---|
21 |
return; |
---|
22 |
end |
---|
23 |
|
---|
24 |
[s]=unix(['cp ',compressed_filename,' .']); |
---|
25 |
slash=findstr(compressed_filename,'/'); |
---|
26 |
last=length(slash); |
---|
27 |
uncompressed_filename=compressed_filename(slash(last)+1:len-2); |
---|
28 |
|
---|
29 |
if s~=0 |
---|
30 |
disp('Error finding file') |
---|
31 |
return; |
---|
32 |
end |
---|
33 |
|
---|
34 |
[s]=unix(['uncompress ',uncompressed_filename,'.Z']); |
---|
35 |
if s~=0 |
---|
36 |
disp('Error compressing file') |
---|
37 |
return; |
---|
38 |
end |
---|
39 |
|
---|
40 |
disp('Loading file ... please be patient.') |
---|
41 |
|
---|
42 |
load(uncompressed_filename); |
---|
43 |
%try |
---|
44 |
% tmpStruc = load( filename ); |
---|
45 |
% data = tmpStruc.data; |
---|
46 |
%catch, return, end |
---|
47 |
|
---|
48 |
|
---|
49 |
[s]=unix(['rm ',uncompressed_filename]); |
---|
50 |
|
---|
51 |
clear uncompressed_filena s slash last len tag |
---|
52 |
|
---|
53 |
return; |
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 |
|
---|