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.
Given two strings, find the maximum overlap
How to subtract?
Set the array elements whose value is 13 to 0
Doubling elements in a vector
Given a 4x4 matrix, swap the two middle columns
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