Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 171453

Submitted on 2 Dec 2012

Incorrect

Size
Leading solution size is 4.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
feval(@assignin,'caller','score',100);

                    
2
Fail
 
%%
format short
format compact
global net_time
s1 = {'abcd','bcde','cdef','defg'};
s2=min_path_cost(s1); % to get good time
t0=clock;
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3;
assert(isequal(s2,'dddd'))
net_time=dt
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
3
Fail
 
%%
global net_time
temp=net_time; % anti-cheat
s1 = {'aldfejk','czoa','vwy','abcde'};
s2=min_path_cost(s1);
t0=clock;
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3
assert(isequal(s2,'love'))
net_time=temp+dt
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
4
Fail
 
%%
global net_time
% anti-cheat
temp=net_time;
s1 = {'aldfejk','czoa','vwy','abcde'};
s2=min_path_cost(s1);
t0=clock;
pause(0.2);
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3
assert(isequal(s2,'love'))
if dt<200
 net_time=2001 % cheat trap fail condition
end
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
5
Fail
 
%%
% not part of the time trial
% avoids look-up table hack - Castano
s1 = cellfun(@(x)char('a'-1+randi(26,1,5)),cell(1,7),'uniformoutput',false);
assert(all(any(bsxfun(@eq,min_path_cost(s1),cell2mat(cellfun(@(x)x',s1,'uniformoutput',false)))))&all(sum(abs(diff(double(min_path_cost(s1)))))<=sum(abs(diff(double(cell2mat(cellfun(@(x)x(randi(numel(x),1,1000))',s1,'uniformoutput',false))),1,2)),2)));
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
6
Fail
 
%%
global net_time
temp=net_time;
s1 = {'lqjfac','deamv','fkazbw','idlw','ajmf','abcwz','wxyz'}; %lmklmww
s2=min_path_cost(s1);
t0=clock;
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3
assert(isequal(s2,'lmklmww'))
net_time=temp+dt
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
7
Fail
 
%%
global net_time
temp=net_time;
s1 = {'lwjac','demv','fkabw','idlw','pqmf','abcnq','fwxyz','mnop'};
s2=min_path_cost(s1);
t0=clock;
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3
assert(isequal(s2,'cdfdfcfm')|isequal(s2,'cdbdfcfm'))
net_time=temp+dt
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
8
Fail
 
%%
global net_time
temp=net_time;
s1 = {'ldjac','demv','fkabw','idlw','pqmf','abcnq','fwxyz','mnop','flap'};
s2=min_path_cost(s1);
t0=clock;
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3
assert(isequal(s2,'ddfdfcfml')|isequal(s2,'ddbdfcfml'))
net_time=temp+dt
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
9
Fail
 
%%
global net_time
temp=net_time;
s1 = {'the','goal','of','life','is','living','in','agreement','with','nature'};
s2=min_path_cost(s1);
t0=clock;
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3
assert(isequal(s2,'hgfiiiighe')|isequal(s2,'hgffiiighe'))
net_time=temp+dt
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
10
Fail
 
%%
global net_time
temp=net_time;
s1 = {'he' 'has','all','the','virtues','idislike','andnone','ofthe','vicesi','admire'};
s2=min_path_cost(s1);
t0=clock;
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3
assert(isequal(s2,'eaaeeeeeee'))
net_time=temp+dt
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
11
Fail
 
%%
global net_time
temp=net_time;
s1 = {'history' 'will','be','kind','to','me','for','i','intend','to','write','it'};
s2=min_path_cost(s1);
t0=clock;
s2=min_path_cost(s1);
dt=etime(clock,t0)*1e3
assert(isequal(s2,'iiekomoiiort')|isequal(s2,'iieiomoiiort'))
net_time=temp+dt
Error: Undefined function 'gobbledigook' for input arguments of type 'cell'.
12
Fail
 
%%
global net_time
% Time performance rqmt
assert(net_time<2000,sprintf('Net time = %s',num2str(net_time)));
Error: The condition input argument must be a scalar logical.
13
Pass
 
%%
global net_time
% net_time in ms
% Create graph data
net_time=min(100,net_time) % Limit graph y-axis
feval(@assignin,'caller','score',floor(net_time));
%fh=fopen('min_path_cost.m','wt');
%fprintf(fh,'%s\n',repmat('1;',[1,round(net_time/2)]));
%fclose(fh);
net_time =
     []