{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.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":"2025-12-14T00: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":2683,"title":"Adding Cells with numbers defined as strings","description":"Given a cell, with strings representing numbers, add each value.\r\n\r\nFor example:\r\n\r\na = {'9','33'};\r\n\r\nthe output should be:\r\n\r\ny = 42\r\n\r\n","description_html":"\u003cp\u003eGiven a cell, with strings representing numbers, add each value.\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cp\u003ea = {'9','33'};\u003c/p\u003e\u003cp\u003ethe output should be:\u003c/p\u003e\u003cp\u003ey = 42\u003c/p\u003e","function_template":"function y = addingcells(a)\r\n  y = cellfun(@(x) x,a);\r\nend","test_suite":"%%\r\nx = {'9','33'};\r\ny_correct = 42;\r\nassert(isequal(addingcells(x),y_correct))\r\n\r\n\r\n%%\r\nx = {'9','33'};\r\ny_correct = 42;\r\nassert(isequal(addingcells(x),y_correct))\r\n\r\n%%\r\nx = {'9','33','-12'};\r\ny_correct = 30;\r\nassert(isequal(addingcells(x),y_correct))\r\n\r\n%%\r\nx = {'9','33','122'};\r\ny_correct = 164;\r\nassert(isequal(addingcells(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4690,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":102,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":32,"created_at":"2014-11-22T17:45:52.000Z","updated_at":"2026-03-19T19:57:12.000Z","published_at":"2014-11-22T17:45:59.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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 cell, with strings representing numbers, add each value.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ea = {'9','33'};\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethe output should be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ey = 42\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":802,"title":"Create a matrix from a cell","description":"In this problem , you must convert a cell into a matrix and pad each cell with NaN. \r\n\r\n\r\n*Example 1:* \r\n\r\nIf you have the input cell:\r\n\r\n  C = {[1 2 3],[]}\r\n\r\nthe output must be the matrix :\r\n\r\n    output = [  1     2     3\r\n               NaN   NaN   NaN]\r\n\r\n\r\n\r\n\r\n*Example 2:* \r\n\r\n  C = {[1 2 3],8,[],[15  3]}\r\n\r\nthe output must be the matrix :\r\n  \r\n       1     2     3\r\n       8   NaN   NaN\r\n     NaN   NaN   NaN\r\n      15     3   NaN\r\n\r\n\r\n\r\n\r\n\r\n","description_html":"\u003cp\u003eIn this problem , you must convert a cell into a matrix and pad each cell with NaN.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample 1:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eIf you have the input cell:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eC = {[1 2 3],[]}\r\n\u003c/pre\u003e\u003cp\u003ethe output must be the matrix :\u003c/p\u003e\u003cpre\u003e    output = [  1     2     3\r\n               NaN   NaN   NaN]\u003c/pre\u003e\u003cp\u003e\u003cb\u003eExample 2:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eC = {[1 2 3],8,[],[15  3]}\r\n\u003c/pre\u003e\u003cp\u003ethe output must be the matrix :\u003c/p\u003e\u003cpre\u003e       1     2     3\r\n       8   NaN   NaN\r\n     NaN   NaN   NaN\r\n      15     3   NaN\u003c/pre\u003e","function_template":"function output= your_fcn_name(C)\r\n  output = C;\r\nend","test_suite":"%% example 1\r\nC = {[1 2 3],[]};\r\n output = [  1     2     3\r\n               NaN   NaN   NaN];\r\nassert(isequalwithequalnans(your_fcn_name(C),output))\r\n\r\n%% example 2\r\nC = {[1 2 3],8,[],[15  3]};\r\ny_correct = [ 1     2     3\r\n     8   NaN   NaN\r\n   NaN   NaN   NaN\r\n    15     3   NaN];\r\n\r\nassert(isequalwithequalnans(your_fcn_name(C),y_correct))\r\n\r\n\r\n%%\r\ntcell = {ones(1,4), [1 2 3 4 5], 1:8, 1, [],0};\r\ny_correct = [   1     1     1     1   NaN   NaN   NaN   NaN\r\n     1     2     3     4     5   NaN   NaN   NaN\r\n     1     2     3     4     5     6     7     8\r\n     1   NaN   NaN   NaN   NaN   NaN   NaN   NaN\r\n   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN\r\n     0   NaN   NaN   NaN   NaN   NaN   NaN   NaN];\r\nassert(isequalwithequalnans(your_fcn_name(tcell),y_correct))\r\n\r\n%%\r\nC = {[]}\r\nassert(isempty(your_fcn_name(C)))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":639,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":75,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-06-28T10:25:57.000Z","updated_at":"2026-03-06T12:32:57.000Z","published_at":"2012-06-28T10:25:57.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\u003eIn this problem , you must convert a cell into a matrix and pad each cell with NaN.\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\u003eExample 1:\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\u003eIf you have the input cell:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[C = {[1 2 3],[]}]]\u003e\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\u003ethe output must be the matrix :\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    output = [  1     2     3\\n               NaN   NaN   NaN]]]\u003e\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\u003eExample 2:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[C = {[1 2 3],8,[],[15  3]}]]\u003e\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\u003ethe output must be the matrix :\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[       1     2     3\\n       8   NaN   NaN\\n     NaN   NaN   NaN\\n      15     3   NaN]]\u003e\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":42810,"title":"String Find with Wildcards of a Cell array","description":"Given a cell array of strings and a search string with single character (?) or multiple character (*) wildness return the indices of the cell array that match.\r\n\r\n*Examples:*\r\n\r\n  {'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\r\n  {'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for * ","description_html":"\u003cp\u003eGiven a cell array of strings and a search string with single character (?) or multiple character (*) wildness return the indices of the cell array that match.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e{'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\r\n{'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for * \r\n\u003c/pre\u003e","function_template":"function idx = stridx(c,str)\r\n% c: cell array of strings\r\n% str: search string with single character ? wild or * multiple wild\r\n% idx: indices of c that contain str\r\n idx=[];\r\n\r\nend","test_suite":"%%\r\nc={'abcdef' '12345' 'matfile.mat' 'fname.xls'};\r\nstr='*.xls';\r\nassert(isequal(stridx(c,str),[4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'fname.xls'};\r\nstr='xls';\r\nassert(isequal(stridx(c,str),[4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='a*f';\r\nassert(isequal(stridx(c,str),[1 3 4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='a?f';\r\nassert(isequal(stridx(c,str),[3]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='1*5';\r\nassert(isequal(stridx(c,str),[2]))\r\n%%\r\nc={'random' 'test.mart' 'rat' 'matfile.mat' 'random.mat' 'matfile'};\r\nstr='.ma*t';\r\nassert(isequal(stridx(c,str),[2 4 5]))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-20T03:25:42.000Z","updated_at":"2016-04-20T03:39:15.000Z","published_at":"2016-04-20T03:39:15.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 cell array of strings and a search string with single character (?) or multiple character \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e(*\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) wildness return the indices of the cell array that match.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[{'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\\n{'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for *]]\u003e\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":868,"title":"Replace all zeros and NaNs in a matrix with the string 'error'","description":"Given a numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with the character string 'error'.\r\nThe output should be a cell array C of the same size as the input matrix. Each cell of the output cell array should either contain the corresponding entry of A if this is not zero or NaN, or the string 'error' otherwise.\r\n\r\nExample:\r\n\r\nIf A = [1 0; NaN 1], then the output C should be the cell array C = {1, 'error'; 'error', 1}.\r\n\r\n","description_html":"\u003cp\u003eGiven a numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with the character string 'error'.\r\nThe output should be a cell array C of the same size as the input matrix. Each cell of the output cell array should either contain the corresponding entry of A if this is not zero or NaN, or the string 'error' otherwise.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003eIf A = [1 0; NaN 1], then the output C should be the cell array C = {1, 'error'; 'error', 1}.\u003c/p\u003e","function_template":"function C = replace_zeros_and_NaNs(A)\r\n\r\nend","test_suite":"%%\r\nA = 1;\r\nassert(isequal({1},replace_zeros_and_NaNs(A)))\r\n\r\n%%\r\nA = [1 0; NaN 1];\r\nC_correct = {1, 'error'; 'error', 1};\r\nassert(isequal(C_correct, replace_zeros_and_NaNs(A)))\r\n\r\n%% \r\nA = [];\r\nassert(isequal({}, replace_zeros_and_NaNs(A)))\r\n\r\n%%\r\nA = magic(5); A([14 3 5 6 7]) = 0; A([1 18 15 20 22]) = NaN;\r\nC_correct = {'error'    'error'   1  8 15; 23 'error' 7 14 'error';'error' 6 13 'error' 22; 10 12 'error' 21 3; 'error' 18 'error' 'error' 9};\r\nassert(isequal(C_correct, replace_zeros_and_NaNs(A)))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":2328,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":103,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-07-28T18:25:06.000Z","updated_at":"2025-12-12T09:58:28.000Z","published_at":"2012-07-28T18:27:08.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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 numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with the character string 'error'. The output should be a cell array C of the same size as the input matrix. Each cell of the output cell array should either contain the corresponding entry of A if this is not zero or NaN, or the string 'error' otherwise.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf A = [1 0; NaN 1], then the output C should be the cell array C = {1, 'error'; 'error', 1}.\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":43076,"title":"Return strings encapsulated by braces","description":"Return all substrings that are contained within braces ({}).\r\n\r\nFor example:\r\n\r\n  str = 'x = rho*x{-1} + (1-rho)*y{+1}';\r\n\r\nwhen passed to the function, should return a cell with '-1' and '+1' as its contents.","description_html":"\u003cp\u003eReturn all substrings that are contained within braces ({}).\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003estr = 'x = rho*x{-1} + (1-rho)*y{+1}';\r\n\u003c/pre\u003e\u003cp\u003ewhen passed to the function, should return a cell with '-1' and '+1' as its contents.\u003c/p\u003e","function_template":"function y = parseBrackets(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nstr = 'series{d-96}x11{second}';\r\ny_correct = {'d-96';'second'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = 'x=rho*x{-1}+(1-rho)*y{+1}';\r\ny_correct = {'-1';'+1'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = 'hello there; this string contains no braces';\r\ny_correct = {};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = '{one} two three {four} five {six} seven';\r\ny_correct = {'one';'four';'six'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = '{Where} in the world {is the} thick, red {encyclopedia?}';\r\ny_correct = {'Where';'is the';'encyclopedia?'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":"2016-10-19T17:46:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T21:13:31.000Z","updated_at":"2025-08-23T20:27:47.000Z","published_at":"2016-10-19T17:41:54.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\u003eReturn all substrings that are contained within braces ({}).\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\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[str = 'x = rho*x{-1} + (1-rho)*y{+1}';]]\u003e\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\u003ewhen passed to the function, should return a cell with '-1' and '+1' as its contents.\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":2699,"title":"From a given cell array of strings, extract the non-unique strings.","description":"We are given a cell array of strings C. From this cell array we require to extract the subset of non-unique strings, returning the results as a column vector. \r\n\r\nFor example, if C = {'A', 'B', 'C', 'A', 'B'}, then the strings 'A' and 'B' are repeated, so the result should be {'A'; 'B'}. The order of occurrence of the strings should be preserved, so {'B'; 'A'} would not be an acceptable solution. The order of appearance of the strings is defined using the column-major format. For example, if C = {'Jack', 'Bob'; 'Dave', 'Amanda'} then the order of the strings is 'Jack', 'Dave', 'Bob', 'Amanda'.","description_html":"\u003cp\u003eWe are given a cell array of strings C. From this cell array we require to extract the subset of non-unique strings, returning the results as a column vector.\u003c/p\u003e\u003cp\u003eFor example, if C = {'A', 'B', 'C', 'A', 'B'}, then the strings 'A' and 'B' are repeated, so the result should be {'A'; 'B'}. The order of occurrence of the strings should be preserved, so {'B'; 'A'} would not be an acceptable solution. The order of appearance of the strings is defined using the column-major format. For example, if C = {'Jack', 'Bob'; 'Dave', 'Amanda'} then the order of the strings is 'Jack', 'Dave', 'Bob', 'Amanda'.\u003c/p\u003e","function_template":"function repeatedStrings = extractRepeatedStrings(C)\r\n  \r\n\r\n\r\nend","test_suite":"%%\r\nC = {'Ken'; 'GianCarlo'; 'Ken'; 'GianCarlo'; 'Bob'; 'Ken'; 'Sonia'};\r\nrepeatedStrings = {'Ken'; 'GianCarlo'};\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n%%\r\nC = {'A', 'B', 'C', 'A', 'B'};\r\nrepeatedStrings = {'A'; 'B'};\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n%%\r\nC = {'B', 'A', 'C', 'B', 'A'};\r\nrepeatedStrings = {'B'; 'A'};\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n%%\r\nC = {'A', 'B', 'C'};\r\nrepeatedStrings = cell.empty(0, 1);\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n%%\r\nC = {'A', 'B'; 'C', 'A'; 'B', 'A'};\r\nrepeatedStrings = {'A'; 'B'};\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2328,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":32,"created_at":"2014-12-01T16:49:18.000Z","updated_at":"2026-03-19T20:10:22.000Z","published_at":"2014-12-01T16:49:55.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eWe are given a cell array of strings C. From this cell array we require to extract the subset of non-unique strings, returning the results as 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, if C = {'A', 'B', 'C', 'A', 'B'}, then the strings 'A' and 'B' are repeated, so the result should be {'A'; 'B'}. The order of occurrence of the strings should be preserved, so {'B'; 'A'} would not be an acceptable solution. The order of appearance of the strings is defined using the column-major format. For example, if C = {'Jack', 'Bob'; 'Dave', 'Amanda'} then the order of the strings is 'Jack', 'Dave', 'Bob', 'Amanda'.\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":733,"title":"Extract Built In Functions and Toolbox Functions from String or Function Handle","description":"Find the Built-In functions and Toolbox functions in either a string or a function handle.\r\n\r\nGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\r\n\r\n*Inputs:*\r\n\r\nfh=@(x)log10(x)+log2(x)+abs(x)\r\n\r\nstr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\r\n\r\n*Outputs:*\r\n\r\n'abs log2 log10'\r\n\r\n'abs filter numel sin filter2 smooth3'\r\n\r\nRelated to \r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer Cody_464\u003e","description_html":"\u003cp\u003eFind the Built-In functions and Toolbox functions in either a string or a function handle.\u003c/p\u003e\u003cp\u003eGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInputs:\u003c/b\u003e\u003c/p\u003e\u003cp\u003efh=@(x)log10(x)+log2(x)+abs(x)\u003c/p\u003e\u003cp\u003estr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutputs:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'abs log2 log10'\u003c/p\u003e\u003cp\u003e'abs filter numel sin filter2 smooth3'\u003c/p\u003e\u003cp\u003eRelated to  \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer\"\u003eCody_464\u003c/a\u003e\u003c/p\u003e","function_template":"function functions = find_functions(fh_str)\r\n  functions = '';\r\nend","test_suite":"%%\r\nfh_str='log2(x)+smooth3(x,y)+abs(2)+log10(5)';\r\nexp_str='abs log10 log2 smooth3';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='for k=log10(x):log2(x)+abs(x)';\r\nexp_str='abs for log10 log2';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str=@(x)x^2+sin(x)-cos(x);\r\nexp_str='cos sin';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='@(x)x^2+sin(x)-cos(x)';\r\nexp_str='cos sin';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='filter2(x,A)+filter(x)-cos(x) expm(z)';\r\nexp_str='cos filter expm filter2';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)';\r\nexp_str='abs filter numel sin filter2 smooth3';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":6,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":83,"test_suite_updated_at":"2012-07-18T13:18:16.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-06-01T23:09:01.000Z","updated_at":"2026-03-31T20:12:36.000Z","published_at":"2012-06-02T00:17:41.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\u003eFind the Built-In functions and Toolbox functions in either a string or a function handle.\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\u003eGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\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\u003eInputs:\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\u003efh=@(x)log10(x)+log2(x)+abs(x)\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\u003estr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\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\u003eOutputs:\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'abs log2 log10'\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'abs filter numel sin filter2 smooth3'\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\u003eRelated to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody_464\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":{"errors":[],"problems":[{"id":2683,"title":"Adding Cells with numbers defined as strings","description":"Given a cell, with strings representing numbers, add each value.\r\n\r\nFor example:\r\n\r\na = {'9','33'};\r\n\r\nthe output should be:\r\n\r\ny = 42\r\n\r\n","description_html":"\u003cp\u003eGiven a cell, with strings representing numbers, add each value.\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cp\u003ea = {'9','33'};\u003c/p\u003e\u003cp\u003ethe output should be:\u003c/p\u003e\u003cp\u003ey = 42\u003c/p\u003e","function_template":"function y = addingcells(a)\r\n  y = cellfun(@(x) x,a);\r\nend","test_suite":"%%\r\nx = {'9','33'};\r\ny_correct = 42;\r\nassert(isequal(addingcells(x),y_correct))\r\n\r\n\r\n%%\r\nx = {'9','33'};\r\ny_correct = 42;\r\nassert(isequal(addingcells(x),y_correct))\r\n\r\n%%\r\nx = {'9','33','-12'};\r\ny_correct = 30;\r\nassert(isequal(addingcells(x),y_correct))\r\n\r\n%%\r\nx = {'9','33','122'};\r\ny_correct = 164;\r\nassert(isequal(addingcells(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4690,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":102,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":32,"created_at":"2014-11-22T17:45:52.000Z","updated_at":"2026-03-19T19:57:12.000Z","published_at":"2014-11-22T17:45:59.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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 cell, with strings representing numbers, add each value.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ea = {'9','33'};\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethe output should be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ey = 42\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":802,"title":"Create a matrix from a cell","description":"In this problem , you must convert a cell into a matrix and pad each cell with NaN. \r\n\r\n\r\n*Example 1:* \r\n\r\nIf you have the input cell:\r\n\r\n  C = {[1 2 3],[]}\r\n\r\nthe output must be the matrix :\r\n\r\n    output = [  1     2     3\r\n               NaN   NaN   NaN]\r\n\r\n\r\n\r\n\r\n*Example 2:* \r\n\r\n  C = {[1 2 3],8,[],[15  3]}\r\n\r\nthe output must be the matrix :\r\n  \r\n       1     2     3\r\n       8   NaN   NaN\r\n     NaN   NaN   NaN\r\n      15     3   NaN\r\n\r\n\r\n\r\n\r\n\r\n","description_html":"\u003cp\u003eIn this problem , you must convert a cell into a matrix and pad each cell with NaN.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample 1:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eIf you have the input cell:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eC = {[1 2 3],[]}\r\n\u003c/pre\u003e\u003cp\u003ethe output must be the matrix :\u003c/p\u003e\u003cpre\u003e    output = [  1     2     3\r\n               NaN   NaN   NaN]\u003c/pre\u003e\u003cp\u003e\u003cb\u003eExample 2:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eC = {[1 2 3],8,[],[15  3]}\r\n\u003c/pre\u003e\u003cp\u003ethe output must be the matrix :\u003c/p\u003e\u003cpre\u003e       1     2     3\r\n       8   NaN   NaN\r\n     NaN   NaN   NaN\r\n      15     3   NaN\u003c/pre\u003e","function_template":"function output= your_fcn_name(C)\r\n  output = C;\r\nend","test_suite":"%% example 1\r\nC = {[1 2 3],[]};\r\n output = [  1     2     3\r\n               NaN   NaN   NaN];\r\nassert(isequalwithequalnans(your_fcn_name(C),output))\r\n\r\n%% example 2\r\nC = {[1 2 3],8,[],[15  3]};\r\ny_correct = [ 1     2     3\r\n     8   NaN   NaN\r\n   NaN   NaN   NaN\r\n    15     3   NaN];\r\n\r\nassert(isequalwithequalnans(your_fcn_name(C),y_correct))\r\n\r\n\r\n%%\r\ntcell = {ones(1,4), [1 2 3 4 5], 1:8, 1, [],0};\r\ny_correct = [   1     1     1     1   NaN   NaN   NaN   NaN\r\n     1     2     3     4     5   NaN   NaN   NaN\r\n     1     2     3     4     5     6     7     8\r\n     1   NaN   NaN   NaN   NaN   NaN   NaN   NaN\r\n   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN\r\n     0   NaN   NaN   NaN   NaN   NaN   NaN   NaN];\r\nassert(isequalwithequalnans(your_fcn_name(tcell),y_correct))\r\n\r\n%%\r\nC = {[]}\r\nassert(isempty(your_fcn_name(C)))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":639,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":75,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-06-28T10:25:57.000Z","updated_at":"2026-03-06T12:32:57.000Z","published_at":"2012-06-28T10:25:57.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\u003eIn this problem , you must convert a cell into a matrix and pad each cell with NaN.\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\u003eExample 1:\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\u003eIf you have the input cell:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[C = {[1 2 3],[]}]]\u003e\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\u003ethe output must be the matrix :\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    output = [  1     2     3\\n               NaN   NaN   NaN]]]\u003e\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\u003eExample 2:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[C = {[1 2 3],8,[],[15  3]}]]\u003e\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\u003ethe output must be the matrix :\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[       1     2     3\\n       8   NaN   NaN\\n     NaN   NaN   NaN\\n      15     3   NaN]]\u003e\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":42810,"title":"String Find with Wildcards of a Cell array","description":"Given a cell array of strings and a search string with single character (?) or multiple character (*) wildness return the indices of the cell array that match.\r\n\r\n*Examples:*\r\n\r\n  {'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\r\n  {'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for * ","description_html":"\u003cp\u003eGiven a cell array of strings and a search string with single character (?) or multiple character (*) wildness return the indices of the cell array that match.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e{'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\r\n{'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for * \r\n\u003c/pre\u003e","function_template":"function idx = stridx(c,str)\r\n% c: cell array of strings\r\n% str: search string with single character ? wild or * multiple wild\r\n% idx: indices of c that contain str\r\n idx=[];\r\n\r\nend","test_suite":"%%\r\nc={'abcdef' '12345' 'matfile.mat' 'fname.xls'};\r\nstr='*.xls';\r\nassert(isequal(stridx(c,str),[4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'fname.xls'};\r\nstr='xls';\r\nassert(isequal(stridx(c,str),[4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='a*f';\r\nassert(isequal(stridx(c,str),[1 3 4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='a?f';\r\nassert(isequal(stridx(c,str),[3]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='1*5';\r\nassert(isequal(stridx(c,str),[2]))\r\n%%\r\nc={'random' 'test.mart' 'rat' 'matfile.mat' 'random.mat' 'matfile'};\r\nstr='.ma*t';\r\nassert(isequal(stridx(c,str),[2 4 5]))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-20T03:25:42.000Z","updated_at":"2016-04-20T03:39:15.000Z","published_at":"2016-04-20T03:39:15.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 cell array of strings and a search string with single character (?) or multiple character \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e(*\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) wildness return the indices of the cell array that match.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[{'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\\n{'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for *]]\u003e\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":868,"title":"Replace all zeros and NaNs in a matrix with the string 'error'","description":"Given a numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with the character string 'error'.\r\nThe output should be a cell array C of the same size as the input matrix. Each cell of the output cell array should either contain the corresponding entry of A if this is not zero or NaN, or the string 'error' otherwise.\r\n\r\nExample:\r\n\r\nIf A = [1 0; NaN 1], then the output C should be the cell array C = {1, 'error'; 'error', 1}.\r\n\r\n","description_html":"\u003cp\u003eGiven a numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with the character string 'error'.\r\nThe output should be a cell array C of the same size as the input matrix. Each cell of the output cell array should either contain the corresponding entry of A if this is not zero or NaN, or the string 'error' otherwise.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003eIf A = [1 0; NaN 1], then the output C should be the cell array C = {1, 'error'; 'error', 1}.\u003c/p\u003e","function_template":"function C = replace_zeros_and_NaNs(A)\r\n\r\nend","test_suite":"%%\r\nA = 1;\r\nassert(isequal({1},replace_zeros_and_NaNs(A)))\r\n\r\n%%\r\nA = [1 0; NaN 1];\r\nC_correct = {1, 'error'; 'error', 1};\r\nassert(isequal(C_correct, replace_zeros_and_NaNs(A)))\r\n\r\n%% \r\nA = [];\r\nassert(isequal({}, replace_zeros_and_NaNs(A)))\r\n\r\n%%\r\nA = magic(5); A([14 3 5 6 7]) = 0; A([1 18 15 20 22]) = NaN;\r\nC_correct = {'error'    'error'   1  8 15; 23 'error' 7 14 'error';'error' 6 13 'error' 22; 10 12 'error' 21 3; 'error' 18 'error' 'error' 9};\r\nassert(isequal(C_correct, replace_zeros_and_NaNs(A)))\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":2328,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":103,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-07-28T18:25:06.000Z","updated_at":"2025-12-12T09:58:28.000Z","published_at":"2012-07-28T18:27:08.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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 numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with the character string 'error'. The output should be a cell array C of the same size as the input matrix. Each cell of the output cell array should either contain the corresponding entry of A if this is not zero or NaN, or the string 'error' otherwise.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIf A = [1 0; NaN 1], then the output C should be the cell array C = {1, 'error'; 'error', 1}.\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":43076,"title":"Return strings encapsulated by braces","description":"Return all substrings that are contained within braces ({}).\r\n\r\nFor example:\r\n\r\n  str = 'x = rho*x{-1} + (1-rho)*y{+1}';\r\n\r\nwhen passed to the function, should return a cell with '-1' and '+1' as its contents.","description_html":"\u003cp\u003eReturn all substrings that are contained within braces ({}).\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003estr = 'x = rho*x{-1} + (1-rho)*y{+1}';\r\n\u003c/pre\u003e\u003cp\u003ewhen passed to the function, should return a cell with '-1' and '+1' as its contents.\u003c/p\u003e","function_template":"function y = parseBrackets(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nstr = 'series{d-96}x11{second}';\r\ny_correct = {'d-96';'second'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = 'x=rho*x{-1}+(1-rho)*y{+1}';\r\ny_correct = {'-1';'+1'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = 'hello there; this string contains no braces';\r\ny_correct = {};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = '{one} two three {four} five {six} seven';\r\ny_correct = {'one';'four';'six'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = '{Where} in the world {is the} thick, red {encyclopedia?}';\r\ny_correct = {'Where';'is the';'encyclopedia?'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":"2016-10-19T17:46:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T21:13:31.000Z","updated_at":"2025-08-23T20:27:47.000Z","published_at":"2016-10-19T17:41:54.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\u003eReturn all substrings that are contained within braces ({}).\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\u003eFor example:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[str = 'x = rho*x{-1} + (1-rho)*y{+1}';]]\u003e\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\u003ewhen passed to the function, should return a cell with '-1' and '+1' as its contents.\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":2699,"title":"From a given cell array of strings, extract the non-unique strings.","description":"We are given a cell array of strings C. From this cell array we require to extract the subset of non-unique strings, returning the results as a column vector. \r\n\r\nFor example, if C = {'A', 'B', 'C', 'A', 'B'}, then the strings 'A' and 'B' are repeated, so the result should be {'A'; 'B'}. The order of occurrence of the strings should be preserved, so {'B'; 'A'} would not be an acceptable solution. The order of appearance of the strings is defined using the column-major format. For example, if C = {'Jack', 'Bob'; 'Dave', 'Amanda'} then the order of the strings is 'Jack', 'Dave', 'Bob', 'Amanda'.","description_html":"\u003cp\u003eWe are given a cell array of strings C. From this cell array we require to extract the subset of non-unique strings, returning the results as a column vector.\u003c/p\u003e\u003cp\u003eFor example, if C = {'A', 'B', 'C', 'A', 'B'}, then the strings 'A' and 'B' are repeated, so the result should be {'A'; 'B'}. The order of occurrence of the strings should be preserved, so {'B'; 'A'} would not be an acceptable solution. The order of appearance of the strings is defined using the column-major format. For example, if C = {'Jack', 'Bob'; 'Dave', 'Amanda'} then the order of the strings is 'Jack', 'Dave', 'Bob', 'Amanda'.\u003c/p\u003e","function_template":"function repeatedStrings = extractRepeatedStrings(C)\r\n  \r\n\r\n\r\nend","test_suite":"%%\r\nC = {'Ken'; 'GianCarlo'; 'Ken'; 'GianCarlo'; 'Bob'; 'Ken'; 'Sonia'};\r\nrepeatedStrings = {'Ken'; 'GianCarlo'};\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n%%\r\nC = {'A', 'B', 'C', 'A', 'B'};\r\nrepeatedStrings = {'A'; 'B'};\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n%%\r\nC = {'B', 'A', 'C', 'B', 'A'};\r\nrepeatedStrings = {'B'; 'A'};\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n%%\r\nC = {'A', 'B', 'C'};\r\nrepeatedStrings = cell.empty(0, 1);\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n%%\r\nC = {'A', 'B'; 'C', 'A'; 'B', 'A'};\r\nrepeatedStrings = {'A'; 'B'};\r\nassert(isequal(extractRepeatedStrings(C), repeatedStrings))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":2328,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":53,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":32,"created_at":"2014-12-01T16:49:18.000Z","updated_at":"2026-03-19T20:10:22.000Z","published_at":"2014-12-01T16:49:55.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eWe are given a cell array of strings C. From this cell array we require to extract the subset of non-unique strings, returning the results as 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFor example, if C = {'A', 'B', 'C', 'A', 'B'}, then the strings 'A' and 'B' are repeated, so the result should be {'A'; 'B'}. The order of occurrence of the strings should be preserved, so {'B'; 'A'} would not be an acceptable solution. The order of appearance of the strings is defined using the column-major format. For example, if C = {'Jack', 'Bob'; 'Dave', 'Amanda'} then the order of the strings is 'Jack', 'Dave', 'Bob', 'Amanda'.\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":733,"title":"Extract Built In Functions and Toolbox Functions from String or Function Handle","description":"Find the Built-In functions and Toolbox functions in either a string or a function handle.\r\n\r\nGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\r\n\r\n*Inputs:*\r\n\r\nfh=@(x)log10(x)+log2(x)+abs(x)\r\n\r\nstr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\r\n\r\n*Outputs:*\r\n\r\n'abs log2 log10'\r\n\r\n'abs filter numel sin filter2 smooth3'\r\n\r\nRelated to \r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer Cody_464\u003e","description_html":"\u003cp\u003eFind the Built-In functions and Toolbox functions in either a string or a function handle.\u003c/p\u003e\u003cp\u003eGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInputs:\u003c/b\u003e\u003c/p\u003e\u003cp\u003efh=@(x)log10(x)+log2(x)+abs(x)\u003c/p\u003e\u003cp\u003estr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutputs:\u003c/b\u003e\u003c/p\u003e\u003cp\u003e'abs log2 log10'\u003c/p\u003e\u003cp\u003e'abs filter numel sin filter2 smooth3'\u003c/p\u003e\u003cp\u003eRelated to  \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer\"\u003eCody_464\u003c/a\u003e\u003c/p\u003e","function_template":"function functions = find_functions(fh_str)\r\n  functions = '';\r\nend","test_suite":"%%\r\nfh_str='log2(x)+smooth3(x,y)+abs(2)+log10(5)';\r\nexp_str='abs log10 log2 smooth3';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='for k=log10(x):log2(x)+abs(x)';\r\nexp_str='abs for log10 log2';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str=@(x)x^2+sin(x)-cos(x);\r\nexp_str='cos sin';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='@(x)x^2+sin(x)-cos(x)';\r\nexp_str='cos sin';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='filter2(x,A)+filter(x)-cos(x) expm(z)';\r\nexp_str='cos filter expm filter2';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n%%\r\nfh_str='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)';\r\nexp_str='abs filter numel sin filter2 smooth3';\r\nassert(isequal(find_functions(fh_str),exp_str))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":6,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":83,"test_suite_updated_at":"2012-07-18T13:18:16.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-06-01T23:09:01.000Z","updated_at":"2026-03-31T20:12:36.000Z","published_at":"2012-06-02T00:17:41.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\u003eFind the Built-In functions and Toolbox functions in either a string or a function handle.\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\u003eGenerate a string of alphabetized Built-In functions followed by alphabetized Functions.\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\u003eInputs:\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\u003efh=@(x)log10(x)+log2(x)+abs(x)\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\u003estr='smooth3(x,y)-filter(x)+abs(n)+filter2(u)+sin(x)+numel(z)'\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\u003eOutputs:\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'abs log2 log10'\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'abs filter numel sin filter2 smooth3'\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\u003eRelated to \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/464-function-sniffer\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody_464\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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\"}]}"}],"term":"tag:\"cellfun\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"cellfun\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"cellfun\"","","\"","cellfun","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f7363772c60\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f7363772bc0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f7363772300\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f7363772ee0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f7363772e40\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f7363772da0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f7363772d00\u003e":"tag:\"cellfun\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f7363772d00\u003e":"tag:\"cellfun\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"cellfun\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"cellfun\"","","\"","cellfun","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f7363772c60\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f7363772bc0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f7363772300\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f7363772ee0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f7363772e40\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f7363772da0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f7363772d00\u003e":"tag:\"cellfun\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f7363772d00\u003e":"tag:\"cellfun\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":2683,"difficulty_rating":"easy"},{"id":802,"difficulty_rating":"easy"},{"id":42810,"difficulty_rating":"easy"},{"id":868,"difficulty_rating":"easy-medium"},{"id":43076,"difficulty_rating":"easy-medium"},{"id":2699,"difficulty_rating":"easy-medium"},{"id":733,"difficulty_rating":"medium-hard"}]}}