Cody

Solution 1208158

Submitted on 8 Jun 2017 by Timothy Greco
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 = [] while ~isempty(x) y = [y x(1)] x(x == x(1)) = [] end end %This code written by profile_id 6602164 ' y = [] y = 9 x = 2 5 y = 9 2 x = 5 y = 9 2 5 x = 1×0 empty double row vector

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

y = [] y = 42 x = 1 1 1 17 17 y = 42 1 x = 17 17 y = 42 1 17 x = 1×0 empty double row vector

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

y = [] y = 0.1229 x = Columns 1 through 17 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 Columns 18 through 24 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 x = Columns 1 through 17 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 Columns 18 through 23 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 x = Columns 1 through 17 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 Columns 18 through 22 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 x = Columns 1 through 17 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 Columns 18 through 21 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 x = Columns 1 through 17 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 Columns 18 through 20 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 x = Columns 1 through 17 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 Columns 18 through 19 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 x = Columns 1 through 17 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 Column 18 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 x = 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 x = 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 x = 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 x = 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 x = 0.2443 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 x = 0.3772 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 x = 0.7803 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 x = 0.5118 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 x = 0.1097 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 x = 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = Columns 1 through 17 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 Column 18 0.4114 x = 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = Columns 1 through 17 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 Columns 18 through 19 0.4114 0.3976 x = 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 y = Columns 1 through 17 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 Columns 18 through 20 0.4114 0.3976 0.6462 x = 0.3602 0.8725 0.3757 0.9157 0.5114 y = Columns 1 through 17 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 Columns 18 through 21 0.4114 0.3976 0.6462 0.3602 x = 0.8725 0.3757 0.9157 0.5114 y = Columns 1 through 17 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 Columns 18 through 22 0.4114 0.3976 0.6462 0.3602 0.8725 x = 0.3757 0.9157 0.5114 y = Columns 1 through 17 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 Columns 18 through 23 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 x = 0.9157 0.5114 y = Columns 1 through 17 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 Columns 18 through 24 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 x = 0.5114 y = Columns 1 through 17 0.1229 0.7960 0.5923 0.4934 0.5413 0.9789 0.2063 0.5136 0.0437 0.9874 0.4203 0.2074 0.2443 0.3772 0.7803 0.5118 0.1097 Columns 18 through 25 0.4114 0.3976 0.6462 0.3602 0.8725 0.3757 0.9157 0.5114 x = 1×0 empty double row vector