AGROW
AGROW
The variable {0} appears to change size on every loop iteration. Consider preallocating for speed.
Re: AGROW
When you want to fill a variable in a loop, it is recommended to create an empty array before filling.
for example,
for k=1:100
sp(k)= sin(10*k-7);
end
sp is filling inside a loop, it is better to use the following MATLAB code :
sp = zeros(100,1)
for k=1:100
sp(k)= sin(10*k-7);
end
for example,
for k=1:100
sp(k)= sin(10*k-7);
end
sp is filling inside a loop, it is better to use the following MATLAB code :
sp = zeros(100,1)
for k=1:100
sp(k)= sin(10*k-7);
end
Who is online
Users browsing this forum: No registered users and 1 guest