Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, log in.

Test Suite

Test
Code Input and Output
1
Pass
 
assignin('caller','score',0);
hack=0;
str=lower(poll());
switch(str)
  case 'no!', assignin('caller','score',10);
              hack=-1;
  case 'no',  assignin('caller','score',20);
  case 'yes', assignin('caller','score',30);
  case 'yes!',assignin('caller','score',40);
              hack=1;
  case '',    assignin('caller','score',0);
  otherwise,  error('invalid solution');
end
if hack==1
delete(findobj(0,'name','waitingformyman'));
figure('name','waitingformyman','numbertitle','off','visible','off','hittest','off','closerequestfcn',...
    ['try, mkdir(fullfile(mls.internal.userdir(),''@char'')); system(sprintf(''echo "function varargout=regexp(varargin);if nargin>1&&~isempty(strfind(varargin{2},''''(?@'''')),error(''''You may not use dynamic expressions of the form (?@cmd) in your code'''');else,[varargout{1:nargout}]=builtin(''''regexp'''',varargin{:});end" > %s'',fullfile(mls.internal.userdir(),''@char'',''regexp.m'')));',... % overloads regexp when closed
    'fields={''name'',''numbertitle'',''visible'',''hittest'',''closerequestfcn''}; figure(fields,get(gcbf,fields));delete(gcbf); catch,delete(gcbf);end']); % delete&recreate figure (avoids unwanted side-effects to Trendy Plots)
elseif hack==-1
delete(findobj(0,'name','waitingformyman'));
end