gusucode.com > datatypes 工具箱matlab源码程序 > datatypes/@tabular/private/replaceRows.m
function t_data = replaceRows(t_data,rowIndices,c) %REPLACEROW Assign one or more rows in a table's data from a 1-by- cell vector. % Copyright 2012-2016 The MathWorks, Inc. import matlab.internal.tableUtils.matricize try nvars = length(t_data); for j = 1:nvars var_j = t_data{j}; % The size of the RHS has to match what it's going into. sizeLHS = size(var_j); sizeLHS(1) = 1; if ~isequal(sizeLHS, size(c{j})) error(message('MATLAB:table:AssignmentDimensionMismatch', t.varDim.labels{varIndices(j)})); end try %#ok<ALIGN> var_j(rowIndices,:) = matricize(c{j}); catch ME, throwAsCaller(ME); end % No need to check for size change, RHS and LHS are identical sizes. t_data{j} = var_j; end catch ME throwAsCaller(ME) end