Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Test inputs. Please use MATLAB. CHALLENGE ACTIVITY 1074. - 10.1.1: Test of input parameters. This tool is provided by a third party. Though your activity

Test inputs. Please use MATLAB.

image text in transcribed

image text in transcribed

CHALLENGE ACTIVITY 1074. - 10.1.1: Test of input parameters. This tool is provided by a third party. Though your activity may be recorded a page refresh may be needed to fill the banner 0/2 Test inputs Write a function called Checkinputs which checks if three inputs parameters are the correct data types. The first second, and third input variables must be a string, numeric, and logical data type, respectively. The output of Checkinputs should be a logical row array. errorCode, with 4 values. If all the tests pass, then errorCode should consist of only false values. If the 1st input parameter is not a string, the 1st array element in errorCode is set true. If the 2nd input parameter is not a numeric, the 2nd array element in errorCode is set true. If the 3rd input parameter is not a logical variable, the 3rd array element in errorCode is set true. The 4th array element in errorCode is set true if three input parameters are not present. >> name="Joe"; spa=3; enrollstatus=true; All datatypes correct error Code = CheckInputs(name, spa, enrollstatus) errorCode = 1x4 logical array >> name=1; gpa=3; enrollstatus=true; X First datatype incorrect errorCode = CheckInputs(name, spa, enrollstatus) errorCode = 1x4 logical array 1 @ @ @ >> name="Joe"; spa=3; enrollstatus=1 X Third datatype incorrect error Code = CheckInputs(name, spa, enrollstatus) enrollstatus = errorCode = 1x4 logical array % Absent input argument >> errorCode = Check Inputs(name, spa) errorCode = 1x4 logical array Function Save C Reset MATLAB Documentation i function errorCode = Check Inputs (name, spa, enrollstatus) Your code goes here % end Code to call your function e Reset 1 name="Joe"; spa=3; enrollstatus=true; X initialize the inputs 2 error code = Check Inputs(name, spa, enrollstatus) Run Function Assessment: Submit Check Checkinputs("Joe", 1, true) returns errorCode=[0 0 0 0]. Check CheckInputs(1, 1, true) returns errorCode = [1 0 0 0. Check CheckInputs("Joe", 'a', true) returns errorCode = [0 1 0 0]. Check Checkinputs("Joe", 1, 1) returns errorCode = [0 0 1 0]. Check CheckInputs("Joe", 1) returns errorCode = [0 0 0 1]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions