Pre allocation in matlab
Show older comments
v = [0 8 1 2 6 4 8]
How do I determine length of the vector?
Also, how do I pre-allocate the descending vector with all zeros?
Thank you!
Accepted Answer
More Answers (1)
fred ssemwogerere
on 10 Feb 2020
leng=length(v); % length of a vector
pA=zeros(1,leng); % pre-allocation with zeros
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!