subsasgn.m

来自「有关matlab的电子书籍有一定的帮助希望有用」· M 代码 · 共 43 行

M
43
字号
function obj = subsasgn(obj,s,rhs);
%SUBSASGN  Method for fdline object

%   Author: T. Krauss
%   Copyright (c) 1988-98 by The MathWorks, Inc.
%   $Revision: 1.3 $

if (isa(rhs,'fdline') & strcmp(s(1).type,'()'))
    rhs = struct(rhs);
    obj = struct(obj);
    obj(s(1).subs{:}) = rhs;
    obj = fdline(obj);
    return
elseif (isempty(rhs) & strcmp(s(1).type,'()') & length(s)==1)
    obj = struct(obj);
    obj(s(1).subs{:}) = [];
    obj = fdline(obj);
    return
end

if strcmp(s(1).type,'()')
    obj_subs = s(1).subs;
    s(1) = [];
else
    obj_subs = {};
    d = size(obj);
    obj_subs = cell(size(d));
    for i = 1:length(d)
        obj_subs{i} = ':';
    end
end

if length(s)>1
    error(['Sorry, can''t assign individual elements or fields of an' ...
           ' FDLINE''s properties.'])
end

switch s(1).type
case '.'
    set(obj(obj_subs{:}),s(1).subs,rhs);    
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?