-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCopyCells.m
45 lines (28 loc) · 1008 Bytes
/
CopyCells.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
function CopyCells()
%Make a copy of all selected cells.
myCircuit = getappdata(gcf,'myCircuit');
%we want to clear the current data
copyParts = getappdata(gcf,'Copies');
copyParts={}; %empty the current copies
%which ones are to be copied. Put them into the copyParts cell array
for i=1:length(myCircuit.Device)
if isa(myCircuit.Device{i},'QCASuperCell')
Sel=0;
for j=1:length(myCircuit.Device{i}.Device)
if strcmp(myCircuit.Device{i}.Device{j}.SelectBox.Selected,'on')
Sel = Sel+1;
end
end
if Sel
copyParts{end+1} = myCircuit.Device{i};
end
else
if strcmp(myCircuit.Device{i}.SelectBox.Selected,'on')
copyParts{end+1} = myCircuit.Device{i};
end
end
end
%put the copied cells into the current fig for pasting later
setappdata(gcf,'Copies',copyParts);
setappdata(gcf,'myCircuit',myCircuit);
end