USING MATLAB ONLY PLEASE COMMENT CODE IN DETAIL SHOW OUTPU
USING MATLAB ONLY - PLEASE COMMENT CODE IN DETAIL & SHOW OUTPUT
Write an M-file.- Write a Function.
Write a function that will accept two single ASCII characters and return a string message. The message the function returns will be based on the following:
If the first character is greater than the second, the function will return the message ‘First greater than second’.
If the first character is less that the second, the function will return the message ‘First less than second’.
If the characters are equal, the function will return the message ‘First equal to second’.
Solution
function msg=asciiChar(a,b)
numa=double(a)
numb=double(b)
if(numa>numb)
msg=\"first is greater than second\"
end
if(numa<numb)
msg=\"first is less than second\"
end
if(numa==numb)
msg=\"first and second are equal\"
end
end

