-
Notifications
You must be signed in to change notification settings - Fork 8
/
opensbematfile.m
56 lines (50 loc) · 1.46 KB
/
opensbematfile.m
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
52
53
54
55
56
function [sbeG,sbeNode,fName]=opensbematfile(filename)
%
% - Read network information from Matlab MAT file.
%
% Systems Biology and Evolution Toolbox (SBEToolbox).
% Authors: James Cai, Kranti Konganti.
% (C) Texas A&M University.
%
% $LastChangedDate: 2013-01-28 16:56:39 -0600 (Mon, 28 Jan 2013) $
% $LastChangedRevision: 378 $
% $LastChangedBy: konganti $
%
sbeG=[]; sbeNode=[]; fName='';
if ispref('SBEToolbox', 'filedir')
prevPath = getpref('SBEToolbox', 'filedir');
else
prevPath = '';
addpref('SBEToolbox', 'filedir', pwd);
end
if ~ispref('SBEToolbox', 'filename')
addpref('SBEToolbox', 'filename', '');
end
if nargin < 1
[filename,pathname] = uigetfile( ...
{'*.mat', 'Matlab Variables Binary Files (*.mat)';
'*.*', 'All Files (*.*)'}, ...
'Open a file', prevPath);
if pathname ~=0
setpref('SBEToolbox', 'filedir', pathname);
setpref('SBEToolbox', 'filename', filename);
end
if isequal(filename,0) || isequal(pathname,0)
return;
else
fName = filename;
filename=fullfile(pathname,filename);
end
end
%disp(['Reading ',filename]);
try
load(filename,'sbeG','sbeNode');
catch ME
sbeG=[]; sbeNode=[];
rethrow(ME)
end
%% Assign empty node as 'N/A'
isemptyNodeNameIdx = find(logical(cellfun(@isempty, sbeNode)));
if ~isempty(isemptyNodeNameIdx) && isempty(sbeNode{isemptyNodeNameIdx})
sbeNode{isemptyNodeNameIdx} = 'N/A';
end