Cody

Solution 663487

Submitted on 30 Apr 2015 by Zikobrelli
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% filetext = fileread('your_fcn_name.m') assert(isempty(strfind(filetext, 'unique'))) assert(isempty(strfind(filetext, 'stable'))) A = [9 2 9 5]; assert(isequal(your_fcn_name(A),unique(A,'stable')))

filetext = function y = your_fcn_name(x) y=x(1) for i=2:numel(x) if any(ismember(y,x(i))) y=y else y=[y x(i)] end end end %This code written by profile_id 4545956 y = 9 y = 9 2 y = 9 2 y = 9 2 5

2   Pass
%% x = [42 1 1 1 42 17 17]; assert(isequal(your_fcn_name(x),unique(x,'stable')))

y = 42 y = 42 1 y = 42 1 y = 42 1 y = 42 1 y = 42 1 17 y = 42 1 17

3   Pass
%% x = rand(1,25); assert(isequal(your_fcn_name(x),unique(x,'stable')))

y = 0.6281 y = 0.6281 0.4287 y = 0.6281 0.4287 0.0433 y = 0.6281 0.4287 0.0433 0.6118 y = 0.6281 0.4287 0.0433 0.6118 0.3604 y = 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 y = 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 y = 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 y = 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Column 10 0.6172 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 11 0.6172 0.9716 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 12 0.6172 0.9716 0.5973 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 13 0.6172 0.9716 0.5973 0.7493 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 14 0.6172 0.9716 0.5973 0.7493 0.2517 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 15 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 16 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 17 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 18 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 0.6720 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 18 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 0.6720 Column 19 0.7505 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 18 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 0.6720 Columns 19 through 20 0.7505 0.1191 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 18 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 0.6720 Columns 19 through 21 0.7505 0.1191 0.7538 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 18 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 0.6720 Columns 19 through 22 0.7505 0.1191 0.7538 0.7460 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 18 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 0.6720 Columns 19 through 23 0.7505 0.1191 0.7538 0.7460 0.7102 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 18 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 0.6720 Columns 19 through 24 0.7505 0.1191 0.7538 0.7460 0.7102 0.4943 y = Columns 1 through 9 0.6281 0.4287 0.0433 0.6118 0.3604 0.6961 0.4134 0.8919 0.5498 Columns 10 through 18 0.6172 0.9716 0.5973 0.7493 0.2517 0.3203 0.1228 0.3580 0.6720 Columns 19 through 25 0.7505 0.1191 0.7538 0.7460 0.7102 0.4943 0.3264