-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetBoxTraits.m
83 lines (58 loc) · 2.12 KB
/
GetBoxTraits.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
function [center height width field] = GetBoxTraits(handles)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
myCircuit = getappdata(gcf,'myCircuit');
center = [0 0 0];
height = 1.5;
width = .5;
field = str2num(handles.changeInputField.String);
x=[];
y=[];
for i=1:length(myCircuit.Device)%set clock field for all cells
if isa(myCircuit.Device{i},'QCASuperCell')
for j=1:length(myCircuit.Device{i}.Device)
if strcmp(myCircuit.Device{i}.Device{j}.SelectBox.Selected,'on')
x(end+1)=myCircuit.Device{i}.Device{j}.CenterPosition(1);
y(end+1)=myCircuit.Device{i}.Device{j}.CenterPosition(2);
myCircuit.Device{i}.Device{j}.ElectricField = [0 str2num(handles.changeInputField.String) 0 ];
end
end
else
if strcmp(myCircuit.Device{i}.SelectBox.Selected,'on')
x(end+1)=myCircuit.Device{i}.CenterPosition(1);
y(end+1)=myCircuit.Device{i}.CenterPosition(2);
myCircuit.Device{i}.ElectricField = [0 str2num(handles.changeInputField.String) 0 ];
end
myCircuit.Device{i}.ElectricField
end
end
x;
y;
%relax and redraw
xdiff=0;
ydiff=0;
% must draw the circuit before we can draw the arrows denoting the electric
% field lines
% myCircuit=myCircuit.CircuitDraw(gca);
if ~isempty(x)
if (length(x) > 1)
xdiff = (max(x)-min(x));
ydiff = (max(y)-min(y));
midy = (max(y)+min(y))/2;
midx = (max(x)+min(x))/2;
% mySignal = mySignal.drawElectrode([midx, midy, 0], ydiff, xdiff,inputfield);
center = [midx midy 0];
height = ydiff;
width = xdiff;
elseif length(x) == 1
xdiff = 0;
ydiff = (max(y)-min(y));
% mySignal = mySignal.drawElectrode([x(1), y(1), 0], ydiff,xdiff,inputfield);
center = [x(1) y(1) 0];
height = ydiff;
width = xdiff;
end
% setappdata(gcf,handles.signalEditor.String,mySignal);
end
setappdata(gcf,'myCircuit',myCircuit);
end