Program an exclusive or operation without using the MATLAB function xor.
Use logical operators like |, &, ~, ... instead.
ans = 0
ans = 1
Can you show me how to write an if statement for this?
I have it in my code. It will not work for the last test.
% this if statement would not work with a=[0 0 1 1];b=[1 0 1 0];.
%if (a==0 & b~=0) || (b==0 & a~=0)
%i = 1;
%i = 0;
%y = i;
Problem statement was not specific and didn't indicate the inputs a, b could be vectors.
Sorry, I just wondered if xor was somehow restricted on this cody . . . I guess not.
just wonder how do you check people using xor() or not, :)
sent from my iPhone.
Read a column of numbers and interpolate missing data
Roll the Dice!
Back to basics 25 - Valid variable names
Stuff the Board
Volume and area of a sphere
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office