Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assign onList with 1 if guestName is included on guestList. Otherwise, assign on

ID: 3587227 • Letter: A

Question

Assign onList with 1 if guestName is included on guestList. Otherwise, assign onList with 0. Note: The isempty(A) function returns a logical 1 (true) if array A is empty and logical 0 (false) otherwise Ex: If guestName is Benjamin' and guestList is Harold Delphia Benjamin Lovie Ena', then onList is 1 Your Function Save C ResetE MATLAB Documentation 1 function onList FindGuest (guestName, guestList) 2 3 end Code to call your function C Reset FindGuest( 'Benjamin', 'Harold Delphia Benjamin Lovie Ena') Run Function Output Assessment Submit FindGuest('BenjaminHarold Delphia Benjamin Lovie Ena') returns 1 FindGuest('MadelineHarold Delphia Benjamin Lovie Ena) returns 0

Explanation / Answer

function [onList, guestName] = FindGuest(guestName, guestList)
> if isempty(guestList)
> end
for elm = strsplit(guestList,' ')
if strcmp(elm, guestName)
> end
end
end

FindGuest('Banjaman','Harold Delphia Banjaman Lovie Ena')

Output:

octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
>> ans = 1