Cody

Solution 1967271

Submitted on 8 Oct 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
x = 'sin'; y=which(x) assert(isequal(path2func(x),y(11:end-1)))

y = 'built-in (/MATLAB/toolbox/matlab/elfun/@double/sin)' M = 454×1 cell array {'/MATLAB/toolbox/matlab/general/addpath.m' } {'/MATLAB/toolbox/matlab/general/private/catdirs.m' } {'/MATLAB/toolbox/matlab/general/private/parsedirs.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/path.m' } {'/MATLAB/toolbox/matlab/general/path.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/isempty.m' } {'/MATLAB/toolbox/matlab/strfun/strsplit.m' } {'/MATLAB/toolbox/matlab/iofun/pathsep.m' } {'/MATLAB/toolbox/matlab/datatypes/@tabular/size.m' } {'/MATLAB/toolbox/matlab/iofun/fileparts.m' } {'/MATLAB/toolbox/symbolic/symbolic/@sym/horzcat.m' } {'/MATLAB/toolbox/matlab/datatypes/@opaque/char.m' } {'/MATLAB/toolbox/matlab/strfun/@cell/strcat.m' } {'/MATLAB/toolbox/matlab/strfun/strcat.m' } {'/MATLAB/toolbox/matlab/strfun/private/strescape.m' } {'/MATLAB/toolbox/matlab/strfun/blanks.m' } {'/MATLAB/toolbox/matlab/iofun/filesep.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/find.m' } {'/MATLAB/toolbox/matlab/general/usejava.m' } {'/MATLAB/toolbox/matlab/iofun/fullfile.m' } {'/MATLAB/toolbox/matlab/iofun/tempdir.m' } {'/MATLAB/toolbox/matlab/graphics/close.p' } {'/MATLAB/toolbox/matlab/randfun/rng.m' } {'/MATLAB/toolbox/matlab/strfun/num2str.m' } {'/MATLAB/toolbox/matlab/connector2/common/+mls/+internal/feature.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/Worker.p' } {'/MATLAB/toolbox/matlab/general/pwd.m' } {'/MATLAB/toolbox/matlab/general/ispc.m' } {'/MATLAB/toolbox/matlab/ops/@cell/setxor.m' } {'/MATLAB/toolbox/matlab/randfun/@RandStream/RandStream.m' } {'/MATLAB/toolbox/matlab/datatypes/num2cell.m' } {'/MATLAB/toolbox/matlab/timefun/now.m' } {'/MATLAB/toolbox/matlab/ops/mpower.m' } {'/MATLAB/toolbox/local/hgrc.m' } {'/MATLAB/toolbox/matlab/general/ismac.m' } {'/MATLAB/toolbox/matlab/uitools/ispref.m' } {'/MATLAB/toolbox/matlab/uitools/private/prefutils.m' } {'/MATLAB/toolbox/matlab/uitools/private/allchildRootHelper.m' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/StoreGrootAppdata.p' } {'/MATLAB/toolbox/matlab/ops/@cell/setdiff.m' } {'/MATLAB/toolbox/matlab/ops/setdiff.m' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/setContainerBoundaries.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/startProxying.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/warmupHelp.p' } {'/MATLAB/toolbox/matlab/graphics/maps/+matlab/+graphics/+chart/+internal/+maps/TileSetReaderEnvironmentManager.p' } {'/MATLAB/toolbox/geoweb/geoweb/+map/+webmap/+internal/BrowserInterfaceEnvironmentManager.p' } {'/MATLAB/toolbox/matlab/ops/@cell/unique.m' } {'/MATLAB/toolbox/matlab/ops/unique.m' } {'/MATLAB/toolbox/matlab/ops/@cell/ismember.m' } {'/MATLAB/toolbox/matlab/ops/ismember.m' } {'/MATLAB/toolbox/matlab/graphics/+matlab/+graphics/+controls/+internal/ToolbarFactory.p' } {'/MATLAB/toolbox/matlab/codetools/embeddedoutputs/+matlab/+internal/+editor/+figure/FigureUtils.p' } {'/MATLAB/toolbox/matlab/strfun/strtok.m' } {'/MATLAB/toolbox/matlab/datatypes/rmfield.m' } {'/MATLAB/toolbox/shared/deviceplugindetection/+internal/+deviceplugindetection/Manager.m' } {'/MATLAB/toolbox/matlab/general/toolboxdir.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/Channel.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/MessageHandler.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/InputStream.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/OutputStream.m' } {'/MATLAB/toolbox/matlab/ops/+matlab/+internal/+math/partialMatchString.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/string.m' } {'/MATLAB/toolbox/matlab/lang/+matlab/+lang/+internal/isMatchingSize.m' } {'/MATLAB/toolb...

Assertion failed.

2   Fail
x = 'peaks'; y=which(x) assert(isequal(path2func(x),y))

y = '/MATLAB/toolbox/matlab/specgraph/peaks.m' M = 455×1 cell array {'/MATLAB/toolbox/matlab/general/addpath.m' } {'/MATLAB/toolbox/matlab/general/private/catdirs.m' } {'/MATLAB/toolbox/matlab/general/private/parsedirs.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/path.m' } {'/MATLAB/toolbox/matlab/general/path.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/isempty.m' } {'/MATLAB/toolbox/matlab/strfun/strsplit.m' } {'/MATLAB/toolbox/matlab/iofun/pathsep.m' } {'/MATLAB/toolbox/matlab/datatypes/@tabular/size.m' } {'/MATLAB/toolbox/matlab/iofun/fileparts.m' } {'/MATLAB/toolbox/symbolic/symbolic/@sym/horzcat.m' } {'/MATLAB/toolbox/matlab/datatypes/@opaque/char.m' } {'/MATLAB/toolbox/matlab/strfun/@cell/strcat.m' } {'/MATLAB/toolbox/matlab/strfun/strcat.m' } {'/MATLAB/toolbox/matlab/strfun/private/strescape.m' } {'/MATLAB/toolbox/matlab/strfun/blanks.m' } {'/MATLAB/toolbox/matlab/iofun/filesep.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/find.m' } {'/MATLAB/toolbox/matlab/general/usejava.m' } {'/MATLAB/toolbox/matlab/iofun/fullfile.m' } {'/MATLAB/toolbox/matlab/iofun/tempdir.m' } {'/MATLAB/toolbox/matlab/graphics/close.p' } {'/MATLAB/toolbox/matlab/randfun/rng.m' } {'/MATLAB/toolbox/matlab/strfun/num2str.m' } {'/MATLAB/toolbox/matlab/connector2/common/+mls/+internal/feature.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/Worker.p' } {'/MATLAB/toolbox/matlab/general/pwd.m' } {'/MATLAB/toolbox/matlab/general/ispc.m' } {'/MATLAB/toolbox/matlab/ops/@cell/setxor.m' } {'/MATLAB/toolbox/matlab/randfun/@RandStream/RandStream.m' } {'/MATLAB/toolbox/matlab/datatypes/num2cell.m' } {'/MATLAB/toolbox/matlab/timefun/now.m' } {'/MATLAB/toolbox/matlab/ops/mpower.m' } {'/MATLAB/toolbox/local/hgrc.m' } {'/MATLAB/toolbox/matlab/general/ismac.m' } {'/MATLAB/toolbox/matlab/uitools/ispref.m' } {'/MATLAB/toolbox/matlab/uitools/private/prefutils.m' } {'/MATLAB/toolbox/matlab/uitools/private/allchildRootHelper.m' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/StoreGrootAppdata.p' } {'/MATLAB/toolbox/matlab/ops/@cell/setdiff.m' } {'/MATLAB/toolbox/matlab/ops/setdiff.m' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/setContainerBoundaries.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/startProxying.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/warmupHelp.p' } {'/MATLAB/toolbox/matlab/graphics/maps/+matlab/+graphics/+chart/+internal/+maps/TileSetReaderEnvironmentManager.p' } {'/MATLAB/toolbox/geoweb/geoweb/+map/+webmap/+internal/BrowserInterfaceEnvironmentManager.p' } {'/MATLAB/toolbox/matlab/ops/@cell/unique.m' } {'/MATLAB/toolbox/matlab/ops/unique.m' } {'/MATLAB/toolbox/matlab/ops/@cell/ismember.m' } {'/MATLAB/toolbox/matlab/ops/ismember.m' } {'/MATLAB/toolbox/matlab/graphics/+matlab/+graphics/+controls/+internal/ToolbarFactory.p' } {'/MATLAB/toolbox/matlab/codetools/embeddedoutputs/+matlab/+internal/+editor/+figure/FigureUtils.p' } {'/MATLAB/toolbox/matlab/strfun/strtok.m' } {'/MATLAB/toolbox/matlab/datatypes/rmfield.m' } {'/MATLAB/toolbox/shared/deviceplugindetection/+internal/+deviceplugindetection/Manager.m' } {'/MATLAB/toolbox/matlab/general/toolboxdir.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/Channel.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/MessageHandler.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/InputStream.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/OutputStream.m' } {'/MATLAB/toolbox/matlab/ops/+matlab/+internal/+math/partialMatchString.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/string.m' } {'/MATLAB/toolbox/matlab/lang/+matlab/+lang/+internal/isMatchingSize.m' } {'/MATLAB/toolbox/matlab/e...

Assertion failed.

3   Fail
x = 'system'; y=which(x) assert(isequal(path2func(x),y(11:end-1)))

y = 'built-in (/MATLAB/toolbox/matlab/general/system)' M = 456×1 cell array {'/MATLAB/toolbox/matlab/general/addpath.m' } {'/MATLAB/toolbox/matlab/general/private/catdirs.m' } {'/MATLAB/toolbox/matlab/general/private/parsedirs.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/path.m' } {'/MATLAB/toolbox/matlab/general/path.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/isempty.m' } {'/MATLAB/toolbox/matlab/strfun/strsplit.m' } {'/MATLAB/toolbox/matlab/iofun/pathsep.m' } {'/MATLAB/toolbox/matlab/datatypes/@tabular/size.m' } {'/MATLAB/toolbox/matlab/iofun/fileparts.m' } {'/MATLAB/toolbox/symbolic/symbolic/@sym/horzcat.m' } {'/MATLAB/toolbox/matlab/datatypes/@opaque/char.m' } {'/MATLAB/toolbox/matlab/strfun/@cell/strcat.m' } {'/MATLAB/toolbox/matlab/strfun/strcat.m' } {'/MATLAB/toolbox/matlab/strfun/private/strescape.m' } {'/MATLAB/toolbox/matlab/strfun/blanks.m' } {'/MATLAB/toolbox/matlab/iofun/filesep.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/find.m' } {'/MATLAB/toolbox/matlab/general/usejava.m' } {'/MATLAB/toolbox/matlab/iofun/fullfile.m' } {'/MATLAB/toolbox/matlab/iofun/tempdir.m' } {'/MATLAB/toolbox/matlab/graphics/close.p' } {'/MATLAB/toolbox/matlab/randfun/rng.m' } {'/MATLAB/toolbox/matlab/strfun/num2str.m' } {'/MATLAB/toolbox/matlab/connector2/common/+mls/+internal/feature.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/Worker.p' } {'/MATLAB/toolbox/matlab/general/pwd.m' } {'/MATLAB/toolbox/matlab/general/ispc.m' } {'/MATLAB/toolbox/matlab/ops/@cell/setxor.m' } {'/MATLAB/toolbox/matlab/randfun/@RandStream/RandStream.m' } {'/MATLAB/toolbox/matlab/datatypes/num2cell.m' } {'/MATLAB/toolbox/matlab/timefun/now.m' } {'/MATLAB/toolbox/matlab/ops/mpower.m' } {'/MATLAB/toolbox/local/hgrc.m' } {'/MATLAB/toolbox/matlab/general/ismac.m' } {'/MATLAB/toolbox/matlab/uitools/ispref.m' } {'/MATLAB/toolbox/matlab/uitools/private/prefutils.m' } {'/MATLAB/toolbox/matlab/uitools/private/allchildRootHelper.m' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/StoreGrootAppdata.p' } {'/MATLAB/toolbox/matlab/ops/@cell/setdiff.m' } {'/MATLAB/toolbox/matlab/ops/setdiff.m' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/setContainerBoundaries.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/startProxying.p' } {'/MATLAB/toolbox/matlab/connector2/worker/+connector/+internal/+lifecycle/+workerStarting/warmupHelp.p' } {'/MATLAB/toolbox/matlab/graphics/maps/+matlab/+graphics/+chart/+internal/+maps/TileSetReaderEnvironmentManager.p' } {'/MATLAB/toolbox/geoweb/geoweb/+map/+webmap/+internal/BrowserInterfaceEnvironmentManager.p' } {'/MATLAB/toolbox/matlab/ops/@cell/unique.m' } {'/MATLAB/toolbox/matlab/ops/unique.m' } {'/MATLAB/toolbox/matlab/ops/@cell/ismember.m' } {'/MATLAB/toolbox/matlab/ops/ismember.m' } {'/MATLAB/toolbox/matlab/graphics/+matlab/+graphics/+controls/+internal/ToolbarFactory.p' } {'/MATLAB/toolbox/matlab/codetools/embeddedoutputs/+matlab/+internal/+editor/+figure/FigureUtils.p' } {'/MATLAB/toolbox/matlab/strfun/strtok.m' } {'/MATLAB/toolbox/matlab/datatypes/rmfield.m' } {'/MATLAB/toolbox/shared/deviceplugindetection/+internal/+deviceplugindetection/Manager.m' } {'/MATLAB/toolbox/matlab/general/toolboxdir.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/Channel.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/MessageHandler.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/InputStream.m' } {'/MATLAB/toolbox/shared/asynciolib/+asyncio/OutputStream.m' } {'/MATLAB/toolbox/matlab/ops/+matlab/+internal/+math/partialMatchString.m' } {'/MATLAB/toolbox/matlab/codetools/@mtree/string.m' } {'/MATLAB/toolbox/matlab/lang/+matlab/+lang/+internal/isMatchingSize.m' } {'/MATLAB/toolbox/...

Assertion failed.