-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakeSuperCellGUI.m
68 lines (40 loc) · 1.62 KB
/
MakeSuperCellGUI.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
57
58
59
60
61
62
63
64
65
66
67
68
function MakeSuperCellGUI()
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
myCircuit = getappdata(gcf,'myCircuit');
%which elements of the circuit will be made into a supercell
SCParts=[];
%find out which ones will be put into the new supercell. Cannot
%add current supercell members to another supercell
for i=1:length(myCircuit.Device)
if ~isa(myCircuit.Device{i},'QCASuperCell') && strcmp(myCircuit.Device{i}.SelectBox.Selected,'on') && strcmp(myCircuit.Device{i}.Type,'Node')
SCParts(end+1)=i; %need to call the cells to become part of the super cell
end
end
%filling supercell with all the devices
if length(SCParts)>1
SuperCell = QCASuperCell();
for i=1:length(SCParts)
SuperCell = SuperCell.addCell(myCircuit.Device{SCParts(i)});
myCircuit.Device{SCParts(i)}={};%emptying the circuit if that part was selected
end
%emptying the old circuit into the new circuit
newCircuit={};
for i=1:length(myCircuit.Device)
if ~isempty(myCircuit.Device{i})
newCircuit{end+1} = myCircuit.Device{i};
end
end
%the new circuit is now the current circuit
myCircuit.Device = newCircuit;
%add the supercell onto the end of the new circuit
myCircuit=myCircuit.addNode(SuperCell);
% myCircuit.GetCellIDs(myCircuit.Device)
myCircuit.Device;
% setappdata(gcf,'myCircuit',myCircuit);
% myCircuit=myCircuit.CircuitDraw(gca);
end
myCircuit.Device;
myCircuit=myCircuit.CircuitDraw(0,gca);
setappdata(gcf,'myCircuit',myCircuit);
end