matlab 在内部代码中部署失败

问题描述 投票:0回答:1

我想编译一个 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
matlab
1个回答
1
投票

对于文件名长度为 1 的文件,代码将失败。请重命名具有如此短文件名的所有文件,或将行更改为:

if length(pth)>1 && strcmpi(pth(end-1:end), '.m') && exist(pth, 'file') == 2 
© www.soinside.com 2019 - 2024. All rights reserved.