-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostselectscan.m
53 lines (50 loc) · 1.88 KB
/
postselectscan.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
function postselectscan(hFigSpecr,scan,selection)
% --- if not the same type scan selected, error and return; otherwise save
% data
if length(selection) >= 2
for iSelection = 2:length(selection)
if scan.selection{iSelection}.length == scan.selection{iSelection-1}.length
colHeadCmp = strcmp(scan.selection{iSelection}.colHead,...
scan.selection{iSelection-1}.colHead);
else
colHeadCmp = 0;
end
if ~isempty(find(colHeadCmp == 0))
uiwait(msgbox('Multi-selections have to be scans of the same type.',...
'Select Scan Error','error','modal'));
return;
end
end
end
scan.selectionIndex = selection; % store the selected scan index (can be different
% from the real scan number is spec file, because of
% the reset of scan number in spec)
settings = getappdata(hFigSpecr,'settings');
settings.scan = scan;
setappdata(hFigSpecr,'settings',settings);
% prepare for plotting
hPopupmenuX = findall(hFigSpecr,'Tag','specr_PopupmenuX');
hPopupmenuY = findall(hFigSpecr,'Tag','specr_PopupmenuY');
hPopupmenuPlotStyle = findall(hFigSpecr,'Tag','specr_PopupmenuPlotStyle');
set(hPopupmenuX,...
'String',scan.selection{end}.colHead,...
'Value',1);
ihklscan = findstr(lower(scan.head{scan.selectionIndex(end)}),' hklscan'); % check if it is hklscan
if ihklscan
a = scan.head{scan.selectionIndex(end)};
b = str2num(a(ihklscan+8:end));
c = find(abs(b([1,3,5])-b([2,4,6]))>eps);
if c
set(hPopupmenuX,...
'String',scan.selection{end}.colHead,...
'Value',c(1));
end
end
set(hPopupmenuY,...
'String',scan.selection{end}.colHead,...
'Value',scan.selection{end}.length);
try
scanplot;
catch
end
zoom out;