-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathloadTensor.m
executable file
·54 lines (48 loc) · 1.64 KB
/
loadTensor.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
function status=loadTensor()
global loadedVars loadedFileName;
global TDALABHOME;
status=false;
[fname, path] = uigetfile( '*.mat', 'Select a MAT-file',horzcat(TDALABHOME,filesep,'benchmark',filesep));
if isequal(fname,0)
status=false;
return;
end
loadedFileName=horzcat(path,fname);
% loadedVars=load(loadedFileName,'-mat');
fvars=whos('-file',loadedFileName);
if isempty(fvars)
errordlg('The file does not contain any data.','Open error','modal');
status=false;
else
loadedVars={fvars(:).name};
clsVars={fvars(:).class};
bytes=[fvars(:).bytes];
TDALABinitialization;
h=findobj('tag','txtSelVar');
set(h,'enable','on');
varnames=loadedVars;
h=findobj('tag','ppSelVar');
set(h,'string',varnames,'enable','on','value',1);
status=true;
totalVarnames=numel(varnames);
flag=true;
for k=1:totalVarnames
clsvar=clsVars{k};
if strcmp(clsvar,'double')||strcmp(clsvar,'tensor')||strcmp(clsvar,'ttensor')||strcmp(clsvar,'ktensor')
set(h,'value',k);
flag=false;
break;
end
end
if flag
h=errordlg('No acceptable variables found. Please select another file.','Load error','modal');
waitfor(h);
loadTensor;
else
h=allchild(0);
oo = findall(h, 'Tag', 'TDALAB' );
set(oo,'name',[fname,' :: ',defstr('TDALAB')]);
selectVars;
end
end
end