USING MATLAB ONLY - PLEASE COMMENT CODE IN DETAIL & SHOW OUTPUT Write an M-file
ID: 3935273 • Letter: U
Question
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’.
Explanation / Answer
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
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.