www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/+mbcutils/setprop.m

    function setprop(L,Property,Value)
%SETPROP vectorized set utility for MATLAB objects
%     setprop(L,Property,Value)

%   Copyright 2010 The MathWorks, Inc.


if ~isscalar(L) && iscell(Value) && isequal(size(L),size(Value))
    for i=1:numel(L)
        L(i).(Property)=Value{i};
    end
else
    for i=1:numel(L)
        L(i).(Property)=Value;
    end
end