Skip to content

Commit 4454f5d

Browse files
committed
ssget: add octave support
1 parent 92873f0 commit 4454f5d

File tree

3 files changed

+105
-18
lines changed

3 files changed

+105
-18
lines changed

CSparse/MATLAB/ssget/ssget.m

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
% get the parameter settings
3131
%-------------------------------------------------------------------------------
3232

33+
have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;
34+
3335
params = ssget_defaults ;
3436

3537
% The ss_index.mat file is used by ssget only, not by ssgui.java.
@@ -85,25 +87,46 @@
8587
% get a new ss_index.mat file
8688
tmp = tempname ; % download to a temp file first
8789
old = [ params.topdir 'files' filesep 'ss_index_old.mat' ] ;
88-
websave (tmp, indexurl) ; % download the latest index file
90+
91+
if (have_octave)
92+
urlwrite(indexurl, tmp) ;
93+
else
94+
websave (tmp, indexurl) ; % download the latest index file
95+
end
96+
8997
try
9098
movefile (indexfile, old, 'f') ; % keep a backup of the old index
9199
catch
92100
% backup failed, continue anyway
93101
end
94-
movefile ([tmp '.mat'], indexfile, 'f');% move the new index into place
102+
103+
if (have_octave)
104+
movefile ([tmp], indexfile, 'f');% move the new index into place
105+
else
106+
movefile ([tmp '.mat'], indexfile, 'f');% move the new index into place
107+
end
95108

96109
% get a new ssstats.csv file
97110
tmp = tempname ; % download to a temp file first
98111
old = [ params.topdir 'files' filesep 'ssstats_old.csv' ] ;
99-
websave (tmp, staturl) ; % download the latest stats file
112+
113+
if (have_octave)
114+
urlwrite(staturl, tmp) ;
115+
else
116+
websave (tmp, staturl) ; % download the latest stats file
117+
end
118+
100119
try
101120
movefile (statfile, old, 'f') ; % keep a backup of the old stats
102121
catch
103122
% backup failed, continue anyway
104123
end
105-
movefile ([tmp '.csv'], statfile, 'f') ;% move the new index into place
106124

125+
if (have_octave)
126+
movefile ([tmp], statfile, 'f') ;% move the new index into place
127+
else
128+
movefile ([tmp '.csv'], statfile, 'f') ;% move the new index into place
129+
end
107130
catch me
108131
err = me.message ;
109132
end
@@ -191,8 +214,14 @@
191214
fprintf ('downloading %s\n', maturl) ;
192215
fprintf ('to %s\n', matfile) ;
193216
tmp = tempname ; % download to a temp file first
194-
websave (tmp, maturl) ;
195-
movefile ([tmp '.mat'], matfile, 'f') ; % move the new matrix into place
217+
218+
if (have_octave)
219+
urlwrite(maturl, tmp) ;
220+
movefile ([tmp], matfile, 'f') ; % move the new matrix into place
221+
else
222+
websave(tmp, maturl) ;
223+
movefile ([tmp, '.mat'], matfile, 'f') ; % move the new matrix into place
224+
end
196225
end
197226

198227
load (matfile) ;

CXSparse/MATLAB/ssget/ssget.m

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
% get the parameter settings
3131
%-------------------------------------------------------------------------------
3232

33+
have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;
34+
3335
params = ssget_defaults ;
3436

3537
% The ss_index.mat file is used by ssget only, not by ssgui.java.
@@ -85,25 +87,46 @@
8587
% get a new ss_index.mat file
8688
tmp = tempname ; % download to a temp file first
8789
old = [ params.topdir 'files' filesep 'ss_index_old.mat' ] ;
88-
websave (tmp, indexurl) ; % download the latest index file
90+
91+
if (have_octave)
92+
urlwrite(indexurl, tmp) ;
93+
else
94+
websave (tmp, indexurl) ; % download the latest index file
95+
end
96+
8997
try
9098
movefile (indexfile, old, 'f') ; % keep a backup of the old index
9199
catch
92100
% backup failed, continue anyway
93101
end
94-
movefile ([tmp '.mat'], indexfile, 'f');% move the new index into place
102+
103+
if (have_octave)
104+
movefile ([tmp], indexfile, 'f');% move the new index into place
105+
else
106+
movefile ([tmp '.mat'], indexfile, 'f');% move the new index into place
107+
end
95108

96109
% get a new ssstats.csv file
97110
tmp = tempname ; % download to a temp file first
98111
old = [ params.topdir 'files' filesep 'ssstats_old.csv' ] ;
99-
websave (tmp, staturl) ; % download the latest stats file
112+
113+
if (have_octave)
114+
urlwrite(staturl, tmp) ;
115+
else
116+
websave (tmp, staturl) ; % download the latest stats file
117+
end
118+
100119
try
101120
movefile (statfile, old, 'f') ; % keep a backup of the old stats
102121
catch
103122
% backup failed, continue anyway
104123
end
105-
movefile ([tmp '.csv'], statfile, 'f') ;% move the new index into place
106124

125+
if (have_octave)
126+
movefile ([tmp], statfile, 'f') ;% move the new index into place
127+
else
128+
movefile ([tmp '.csv'], statfile, 'f') ;% move the new index into place
129+
end
107130
catch me
108131
err = me.message ;
109132
end
@@ -191,8 +214,14 @@
191214
fprintf ('downloading %s\n', maturl) ;
192215
fprintf ('to %s\n', matfile) ;
193216
tmp = tempname ; % download to a temp file first
194-
websave (tmp, maturl) ;
195-
movefile ([tmp '.mat'], matfile, 'f') ; % move the new matrix into place
217+
218+
if (have_octave)
219+
urlwrite(maturl, tmp) ;
220+
movefile ([tmp], matfile, 'f') ; % move the new matrix into place
221+
else
222+
websave(tmp, maturl) ;
223+
movefile ([tmp, '.mat'], matfile, 'f') ; % move the new matrix into place
224+
end
196225
end
197226

198227
load (matfile) ;

ssget/ssget.m

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
% get the parameter settings
3131
%-------------------------------------------------------------------------------
3232

33+
have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;
34+
3335
params = ssget_defaults ;
3436

3537
% The ss_index.mat file is used by ssget only, not by ssgui.java.
@@ -85,25 +87,46 @@
8587
% get a new ss_index.mat file
8688
tmp = tempname ; % download to a temp file first
8789
old = [ params.topdir 'files' filesep 'ss_index_old.mat' ] ;
88-
websave (tmp, indexurl) ; % download the latest index file
90+
91+
if (have_octave)
92+
urlwrite(indexurl, tmp) ;
93+
else
94+
websave (tmp, indexurl) ; % download the latest index file
95+
end
96+
8997
try
9098
movefile (indexfile, old, 'f') ; % keep a backup of the old index
9199
catch
92100
% backup failed, continue anyway
93101
end
94-
movefile ([tmp '.mat'], indexfile, 'f');% move the new index into place
102+
103+
if (have_octave)
104+
movefile ([tmp], indexfile, 'f');% move the new index into place
105+
else
106+
movefile ([tmp '.mat'], indexfile, 'f');% move the new index into place
107+
end
95108

96109
% get a new ssstats.csv file
97110
tmp = tempname ; % download to a temp file first
98111
old = [ params.topdir 'files' filesep 'ssstats_old.csv' ] ;
99-
websave (tmp, staturl) ; % download the latest stats file
112+
113+
if (have_octave)
114+
urlwrite(staturl, tmp) ;
115+
else
116+
websave (tmp, staturl) ; % download the latest stats file
117+
end
118+
100119
try
101120
movefile (statfile, old, 'f') ; % keep a backup of the old stats
102121
catch
103122
% backup failed, continue anyway
104123
end
105-
movefile ([tmp '.csv'], statfile, 'f') ;% move the new index into place
106124

125+
if (have_octave)
126+
movefile ([tmp], statfile, 'f') ;% move the new index into place
127+
else
128+
movefile ([tmp '.csv'], statfile, 'f') ;% move the new index into place
129+
end
107130
catch me
108131
err = me.message ;
109132
end
@@ -191,8 +214,14 @@
191214
fprintf ('downloading %s\n', maturl) ;
192215
fprintf ('to %s\n', matfile) ;
193216
tmp = tempname ; % download to a temp file first
194-
websave (tmp, maturl) ;
195-
movefile ([tmp '.mat'], matfile, 'f') ; % move the new matrix into place
217+
218+
if (have_octave)
219+
urlwrite(maturl, tmp) ;
220+
movefile ([tmp], matfile, 'f') ; % move the new matrix into place
221+
else
222+
websave(tmp, maturl) ;
223+
movefile ([tmp, '.mat'], matfile, 'f') ; % move the new matrix into place
224+
end
196225
end
197226

198227
load (matfile) ;

0 commit comments

Comments
 (0)