matlab在内部代码中部署失败

时间:2014-02-07 07:10:00

标签: matlab compiler-construction

我想编译一个gui matlab项目,但由于这个错误而失败,而这个错误并不在我的代码中

Subscript indices must either be real positive integers or logicals.

Error in isscript (line 7)
        if strcmpi(pth(end-1:end), '.m') && exist(pth, 'file') == 2

Error in matlab.depfun.internal.Schema/move/@(setMembers)setMembers(~isscript(setMembers))


Error in matlab.depfun.internal.Schema>applyMoveFcn (line 987)
    keptFiles = fcn(fileList);

Error in matlab.depfun.internal.Schema>@(files,destMap)applyMoveFcn(op,files,destMap,destSet,reason,rule) (line 822)
                    @(files, destMap)applyMoveFcn(op, files, destMap, ...

Error in matlab.depfun.internal.Schema/applySetRules (line 141)
                        xformedSet = feval(operations{n}, xformedSet, rMap);

Error in matlab.depfun.internal.Completion/applySetRules (line 1059)
            [modifiedList, rMap] = ...

Error in matlab.depfun.internal.Completion/initializeRootSet (line 1142)
            [addedFiles, ruleFilter, notes] = ...

Error in matlab.depfun.internal.Completion (line 1601)
                obj.RootSet = initializeRootSet(obj, files);

Error in matlab.depfun.internal.requirements (line 166)
    c = matlab.depfun.internal.Completion(files, tgt);

Error in appcreate.internal.appbuilder.getDependencyList (line 173)
            [dependentfiles, depproducts, ~] = matlab.depfun.internal.requirements(varargin, 'MATLAB');

如何让matlab(2013b)编译包?

matlab失败的代码是(这不是我的代码)

function tf = isscript(files)
% ISSCRIPT Is the file a script file?
tf = false(1,numel(files));
for k=1:numel(files)
    pth = files{k};
    % Can't be a script if it isn't an M-file.
    if strcmpi(pth(end-1:end), '.m') && exist(pth, 'file') == 2 
        mt = matlab.depfun.internal.cacheMtree(pth);
        fcn = mtfind(mt, 'Kind', 'FUNCTION');
        tf(k) = isempty(fcn);
    end
end

1 个答案:

答案 0 :(得分:1)

对于文件名为长度为1的文件,代码将失败。要么使用如此短的文件名重命名所有文件,要么将该行更改为:

if length(pth)>1 && strcmpi(pth(end-1:end), '.m') && exist(pth, 'file') == 2 
相关问题