{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-05-26T00:16:20.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-05-26T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":950,"title":"Cody Matlab Version","description":"What is the current Cody Matlab Release? \r\n\r\n*Output:* string\r\n\r\n\r\n*Examples:*\r\n\r\n\r\n'(R2012a)' or 'R2012a'\r\n\r\n\r\nHint: We have moved forward\r\n\r\nPosted 9/16/12","description_html":"\u003cp\u003eWhat is the current Cody Matlab Release?\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e string\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'(R2012a)' or 'R2012a'\u003c/p\u003e\u003cp\u003eHint: We have moved forward\u003c/p\u003e\u003cp\u003ePosted 9/16/12\u003c/p\u003e","function_template":"function str = Cody_version\r\n  str='(R2012a)';\r\nend","test_suite":"%%\r\n% 09/21/2012\r\nstr=Cody_version;\r\nlatest=ver;\r\nRelease=latest(1,1).Release;\r\nRelease2= regexprep(Release,'[()]','');\r\nPass= strcmp(str,Release) || strcmp(str,Release2);\r\nassert(isequal(Pass,1))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":176,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-09-16T23:58:44.000Z","updated_at":"2026-05-22T10:50:38.000Z","published_at":"2012-09-17T00:50:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat is the current Cody Matlab Release?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e string\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'(R2012a)' or 'R2012a'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHint: We have moved forward\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePosted 9/16/12\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":925,"title":"Unique - Very Very Large Numbers","description":"Given a vector column, with some very large numbers, create the ascending sort and unique vector.\r\n\r\n*Input:* A  (column vector)\r\n\r\n*Output:* B (unique and ascending sorted column vector)\r\n\r\n*Examples:* [5;4;3;2;2;1] outputs [1;2;3;4;5]\r\n\r\n[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808] ","description_html":"\u003cp\u003eGiven a vector column, with some very large numbers, create the ascending sort and unique vector.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e A  (column vector)\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e B (unique and ascending sorted column vector)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [5;4;3;2;2;1] outputs [1;2;3;4;5]\u003c/p\u003e\u003cp\u003e[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808]\u003c/p\u003e","function_template":"function y = unique_large(x)\r\n  y = unique(x);\r\nend","test_suite":"%%\r\na=randi(2^32,100,'uint32');\r\nassert(isequal(unique_large(a),unique(a)))\r\n%%\r\nformat long\r\na=[uint64(9223372036854775808);uint64(9223372036854775806)];\r\nout=unique_large(a);\r\nassert(isequal(out,flipud(a)),sprintf('\\nsize(a)= %i %i \\noutput= \\n %14.0f\\n %14.0f \\n',size(out),out))\r\n%%\r\nformat long\r\na=[uint64(18446744073709551615);uint64(18233720368547758060);uint64(9223372036854779806)];\r\n\r\nout=unique_large(a);\r\n\r\nassert(isequal(out,flipud(a)),sprintf('\\nsize(a)= %i %i \\noutput= \\n %16.0f \\n %16.0f \\n %16.0f \\n',size(out),out))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-29T18:59:33.000Z","updated_at":"2026-05-26T05:13:09.000Z","published_at":"2012-08-29T19:55:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector column, with some very large numbers, create the ascending sort and unique vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A (column vector)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e B (unique and ascending sorted column vector)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [5;4;3;2;2;1] outputs [1;2;3;4;5]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":926,"title":"Unique: Speed Enhancement for uint(8,16,32)","description":"This Speed Performance Challenge is to optimize Unique for processing uint8/uint16/uint32 variables.\r\n\r\n*Input:* A (column vector of uint8/uint16/uint32)\r\n\r\n*Output:* B (column vector A processed by unique \"like\" function)\r\n\r\n*Scoring:* Cumulative time, in msec, of \"unique\" processing of three medium size arrays.\r\n\r\n\r\nExamples:\r\n[5;4;3;2;2;1] returns [1;2;3;4;5], and Fast\r\n\r\n\r\nHint: Help Unique, Legacy, Options\r\n\r\n","description_html":"\u003cp\u003eThis Speed Performance Challenge is to optimize Unique for processing uint8/uint16/uint32 variables.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e A (column vector of uint8/uint16/uint32)\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e B (column vector A processed by unique \"like\" function)\u003c/p\u003e\u003cp\u003e\u003cb\u003eScoring:\u003c/b\u003e Cumulative time, in msec, of \"unique\" processing of three medium size arrays.\u003c/p\u003e\u003cp\u003eExamples:\r\n[5;4;3;2;2;1] returns [1;2;3;4;5], and Fast\u003c/p\u003e\u003cp\u003eHint: Help Unique, Legacy, Options\u003c/p\u003e","function_template":"function y = unique_fast(x)\r\n  y = unique(x);\r\nend","test_suite":"%%\r\nfeval(@assignin,'caller','score',0);\r\n%%\r\nx8=randi(255,1000000,5,'uint8');\r\n\r\nx16=randi(2^16,1000000,4,'uint16');\r\n\r\nx32=randi(2^32,3000000,1,'uint32');\r\n\r\nfor i=1:5 % Warmup Calls to get valid timing\r\n x8w=unique_fast(x8);\r\nend\r\n\r\nta=clock;\r\n%tic\r\n x8u=unique_fast(x8);\r\n%toc\r\n%tic\r\n x16u=unique_fast(x16);\r\n%toc\r\n%tic\r\n x32u=unique_fast(x32);\r\n%toc\r\nt1=etime(clock,ta)*1000;\r\n\r\nassert(isequal(x8u,unique(x8)))\r\nassert(isequal(x16u,unique(x16)))\r\nassert(isequal(x32u,unique(x32)))\r\n\r\nt2=min(2000,t1); % unique scores 2000 msec\r\nfeval(@assignin,'caller','score',floor(t2));\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-30T03:48:18.000Z","updated_at":"2026-05-26T05:13:11.000Z","published_at":"2012-08-30T04:20:02.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Speed Performance Challenge is to optimize Unique for processing uint8/uint16/uint32 variables.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A (column vector of uint8/uint16/uint32)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e B (column vector A processed by unique \\\"like\\\" function)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eScoring:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cumulative time, in msec, of \\\"unique\\\" processing of three medium size arrays.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExamples: [5;4;3;2;2;1] returns [1;2;3;4;5], and Fast\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHint: Help Unique, Legacy, Options\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"problems":[{"id":950,"title":"Cody Matlab Version","description":"What is the current Cody Matlab Release? \r\n\r\n*Output:* string\r\n\r\n\r\n*Examples:*\r\n\r\n\r\n'(R2012a)' or 'R2012a'\r\n\r\n\r\nHint: We have moved forward\r\n\r\nPosted 9/16/12","description_html":"\u003cp\u003eWhat is the current Cody Matlab Release?\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e string\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'(R2012a)' or 'R2012a'\u003c/p\u003e\u003cp\u003eHint: We have moved forward\u003c/p\u003e\u003cp\u003ePosted 9/16/12\u003c/p\u003e","function_template":"function str = Cody_version\r\n  str='(R2012a)';\r\nend","test_suite":"%%\r\n% 09/21/2012\r\nstr=Cody_version;\r\nlatest=ver;\r\nRelease=latest(1,1).Release;\r\nRelease2= regexprep(Release,'[()]','');\r\nPass= strcmp(str,Release) || strcmp(str,Release2);\r\nassert(isequal(Pass,1))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":176,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-09-16T23:58:44.000Z","updated_at":"2026-05-22T10:50:38.000Z","published_at":"2012-09-17T00:50:33.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat is the current Cody Matlab Release?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e string\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'(R2012a)' or 'R2012a'\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHint: We have moved forward\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePosted 9/16/12\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":925,"title":"Unique - Very Very Large Numbers","description":"Given a vector column, with some very large numbers, create the ascending sort and unique vector.\r\n\r\n*Input:* A  (column vector)\r\n\r\n*Output:* B (unique and ascending sorted column vector)\r\n\r\n*Examples:* [5;4;3;2;2;1] outputs [1;2;3;4;5]\r\n\r\n[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808] ","description_html":"\u003cp\u003eGiven a vector column, with some very large numbers, create the ascending sort and unique vector.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e A  (column vector)\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e B (unique and ascending sorted column vector)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [5;4;3;2;2;1] outputs [1;2;3;4;5]\u003c/p\u003e\u003cp\u003e[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808]\u003c/p\u003e","function_template":"function y = unique_large(x)\r\n  y = unique(x);\r\nend","test_suite":"%%\r\na=randi(2^32,100,'uint32');\r\nassert(isequal(unique_large(a),unique(a)))\r\n%%\r\nformat long\r\na=[uint64(9223372036854775808);uint64(9223372036854775806)];\r\nout=unique_large(a);\r\nassert(isequal(out,flipud(a)),sprintf('\\nsize(a)= %i %i \\noutput= \\n %14.0f\\n %14.0f \\n',size(out),out))\r\n%%\r\nformat long\r\na=[uint64(18446744073709551615);uint64(18233720368547758060);uint64(9223372036854779806)];\r\n\r\nout=unique_large(a);\r\n\r\nassert(isequal(out,flipud(a)),sprintf('\\nsize(a)= %i %i \\noutput= \\n %16.0f \\n %16.0f \\n %16.0f \\n',size(out),out))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":81,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-29T18:59:33.000Z","updated_at":"2026-05-26T05:13:09.000Z","published_at":"2012-08-29T19:55:58.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a vector column, with some very large numbers, create the ascending sort and unique vector.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A (column vector)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e B (unique and ascending sorted column vector)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [5;4;3;2;2;1] outputs [1;2;3;4;5]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e[9223372036854775808;9223372036854775806] outputs [9223372036854775806;9223372036854775808]\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":926,"title":"Unique: Speed Enhancement for uint(8,16,32)","description":"This Speed Performance Challenge is to optimize Unique for processing uint8/uint16/uint32 variables.\r\n\r\n*Input:* A (column vector of uint8/uint16/uint32)\r\n\r\n*Output:* B (column vector A processed by unique \"like\" function)\r\n\r\n*Scoring:* Cumulative time, in msec, of \"unique\" processing of three medium size arrays.\r\n\r\n\r\nExamples:\r\n[5;4;3;2;2;1] returns [1;2;3;4;5], and Fast\r\n\r\n\r\nHint: Help Unique, Legacy, Options\r\n\r\n","description_html":"\u003cp\u003eThis Speed Performance Challenge is to optimize Unique for processing uint8/uint16/uint32 variables.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e A (column vector of uint8/uint16/uint32)\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e B (column vector A processed by unique \"like\" function)\u003c/p\u003e\u003cp\u003e\u003cb\u003eScoring:\u003c/b\u003e Cumulative time, in msec, of \"unique\" processing of three medium size arrays.\u003c/p\u003e\u003cp\u003eExamples:\r\n[5;4;3;2;2;1] returns [1;2;3;4;5], and Fast\u003c/p\u003e\u003cp\u003eHint: Help Unique, Legacy, Options\u003c/p\u003e","function_template":"function y = unique_fast(x)\r\n  y = unique(x);\r\nend","test_suite":"%%\r\nfeval(@assignin,'caller','score',0);\r\n%%\r\nx8=randi(255,1000000,5,'uint8');\r\n\r\nx16=randi(2^16,1000000,4,'uint16');\r\n\r\nx32=randi(2^32,3000000,1,'uint32');\r\n\r\nfor i=1:5 % Warmup Calls to get valid timing\r\n x8w=unique_fast(x8);\r\nend\r\n\r\nta=clock;\r\n%tic\r\n x8u=unique_fast(x8);\r\n%toc\r\n%tic\r\n x16u=unique_fast(x16);\r\n%toc\r\n%tic\r\n x32u=unique_fast(x32);\r\n%toc\r\nt1=etime(clock,ta)*1000;\r\n\r\nassert(isequal(x8u,unique(x8)))\r\nassert(isequal(x16u,unique(x16)))\r\nassert(isequal(x32u,unique(x32)))\r\n\r\nt2=min(2000,t1); % unique scores 2000 msec\r\nfeval(@assignin,'caller','score',floor(t2));\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":27,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-30T03:48:18.000Z","updated_at":"2026-05-26T05:13:11.000Z","published_at":"2012-08-30T04:20:02.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Speed Performance Challenge is to optimize Unique for processing uint8/uint16/uint32 variables.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e A (column vector of uint8/uint16/uint32)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e B (column vector A processed by unique \\\"like\\\" function)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eScoring:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cumulative time, in msec, of \\\"unique\\\" processing of three medium size arrays.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExamples: [5;4;3;2;2;1] returns [1;2;3;4;5], and Fast\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHint: Help Unique, Legacy, Options\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"errors":[],"facets":[[],[{"value":"easy","count":2,"selected":false},{"value":"medium","count":1,"selected":false}]],"term":"tag:\"r2012a\"","page":1,"per_page":50,"sort":"map(difficulty_value,0,0,999) asc"}}