| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Embedded MATLAB |
| Contents | Index |
X = eml.nullcopy(A)
X = eml.nullcopy(A) copies type, size, and complexity of A to X, but does not copy element values. Preallocates memory for X without incurring the overhead of initializing memory.
Use this function with caution. See Rules for Declaring Uninitialized Variables in the Embedded MATLAB User's Guide documentation.
The following example shows how to declare variable X as a 1-by-5 vector of real doubles without performing an unnecessary initialization:
function X = foo
N = 5;
X = eml.nullcopy(zeros(1,N));
for i = 1:N
if mod(i,2) == 0
X(i) = i;
else
X(i) = 0;
end
endUsing eml.nullcopy with zeros lets you specify the size of vector X without initializing each element to zero.

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |