[go: up one dir, main page]

Menu

[73c35b]: / anal / canon.m  Maximize  Restore  History

Download this file

52 lines (42 with data), 1.2 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
48
49
50
51
% canon.m: A function that repairs file names
% GUISDAP v.8.4 04-08-27 Copyright EISCAT, Huuskonen&Lehtinen
%
function fn=canon(fn,output);
global local
if nargin==1
output=1;
end
ext='.mat';
if isempty(strfind(fn,ext))
fn=[fn ext];
end
if isempty(strfind(fn,'.bz2')) & isempty(strfind(fn,'.gz')) & ~exist(fn,'file')
if exist([fn '.bz2'],'file')
fn=[fn '.bz2'];
elseif exist([fn '.gz'],'file')
fn=[fn '.gz'];
end
end
if output
disp(['canon: ' fn])
end
if strfind(fn,'.bz2')
if isunix
% should work on posix-compliant systems: linux, OSX, and even Cygwin
prog='lbunzip2'; %faster
if unix(['which ' prog ' >/dev/null 2>&1']), prog='bunzip2'; end
system([prog ' -ck ' fn ' >' local.tfile ext]);
%system(['pbzip2 -cd ' fn ' >' local.tfile ext]);
elseif ispc
%We run on Windows. adapt this path as needed
system(['"C:\Program Files\7-Zip\7z.exe" e -so "' fn '" >' local.tfile ext] );
end
fn=[local.tfile ext];
elseif strfind(fn,'.gz')
if isunix
system(['gunzip -c ' fn ' >' local.tfile ext]);
elseif ispc
system(['"c:\Program Files\7-zip\7z.exe" e -so "' fn '" >' local.tfile ext] );
end
fn=[local.tfile ext];
end