Switch array GUI. The following script illustrates how to form a switch matrix GUI. Additional commands can replace the “disp()” instructions.

x = [0 1 1 0 0]; % define sqaure
y = [0 0 1 1 0];
plot(x,y)
axis([0 3 0 3])
axis off
axis square
hold on
plot(x+2,y) % plot 4 squares
plot(x,y+2)
plot(x+2,y+2)
hold off
text(.5,2.5,'A') % label squares with letters
text(2.5,2.5,'B')
text(.5,.5,'C')
text(2.5,.5,'D')


while(1)

[xp yp]= ginput(1); % get cursor position

if xp<1.5 % on left side

if yp>1.5 % on top-left

disp('A')

else

disp('C') % on bottom-left

end

else

% on right side

if yp>1.5

disp('B') % on top-right

else

disp('D') % on bottom-right

Trades & Technology

You might also like to view...

What is the purpose of a separation joint?

What will be an ideal response?

Trades & Technology

The subsequent problems deal with the circuit below where:R1=5k?, R2=10k?, R3=5k?, R4=10k?, R5=10k?, V1=5V, and V2=10V.What is the voltage at node A?

A. 2.5 mV B. 2.5 kV C. ?2.5 V D. 2.5 V E. ?2.5 mV

Trades & Technology

Where are the pressure lines and how are they marked?

What will be an ideal response?

Trades & Technology

The air compressor stops pumping air at what psi?

a. 100 b. 125 c. 150

Trades & Technology