Cody

Solution 1441334

Submitted on 15 Feb 2018 by Hannes
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) x(arrayfun(@(y,i) find(x == y, 1) == i, x, 1:length(x))) end %This code written by profile_id 2887951 ' ans = 9 2 5

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

ans = 42 1 17

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

ans = Columns 1 through 17 0.4060 0.9255 0.1607 0.3679 0.1801 0.7582 0.0361 0.5409 0.7310 0.4713 0.6774 0.1332 0.9193 0.4840 0.6926 0.4705 0.2116 Columns 18 through 25 0.9704 0.1330 0.5865 0.7353 0.3346 0.9954 0.2616 0.5392