Cody

Solution 450597

Submitted on 5 Jun 2014 by rifat
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 ans = your_fcn_name(x) [~,ID]=union(x,[]) x(sort(ID)) end %This code written by profile_id 3437206 ID = 2 4 1 ans = 9 2 5

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

ID = 2 6 1 ans = 42 1 17

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

ID = 22 6 3 16 11 7 17 14 8 5 21 25 19 15 1 23 2 4 18 24 13 9 20 10 12 ans = Columns 1 through 9 0.8147 0.9058 0.1270 0.9134 0.6324 0.0975 0.2785 0.5469 0.9575 Columns 10 through 18 0.9649 0.1576 0.9706 0.9572 0.4854 0.8003 0.1419 0.4218 0.9157 Columns 19 through 25 0.7922 0.9595 0.6557 0.0357 0.8491 0.9340 0.6787