assign.m

来自「The MatlabBGL library fills a hole in Ma」· M 代码 · 共 28 行

M
28
字号
function ipd = assign(ipd,y,varargin)
% IPDOUBLE/ASSIGN Assign an entire in-place double.
%
% assign(ipd,y) overwrites the contents of ipd with y.  The size of ipd and
% y must match.
%
% Example:
%    ipd = ipdouble(ones(5,1));
%    assign(ipd,pi*ones(5,1));

if (isempty(x))

    if any(size(size(ipd)) ~= size(size(y))) || ...
       any(size(ipd) ~= size(y))
        error('ipdouble:invalidParameter','In assign(ipd,y) size(ipd) must equal size(y).');
    end;

    %ipd(:) = y(:);
    %ipd(1) = 5;
    subs = {':'};
    S = struct('type','()','subs',[]);
    S.subs = subs;
    subsasgn(ipd,S,y);
else
    S = struct('type','()','subs',[]);
    S.subs = varargin;
    subsasgn(ipd,S,y);
end;

⌨️ 快捷键说明

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