Tell me more ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given the code :

function[p] = addMoreCells(v,n)
% adding zero at the beginning 
k = length(v);
if (k ~= n)
    p = zeros(1,n);
    for m = (n-1):-1:(n-k)
        p(m+1) = v(k-(n-m-1));
    end
else
    p = v;
end
end

I build a new array with n cells and put there 0 , later I add the other cells from v .

It there a built in command that can perform that instead ?

Thanks

share|improve this question
1  
This should be asked at StackOverflow instead. – Rahul Narain Jun 14 '12 at 2:41
While mathematics software is on-topic for math.SE, I think your question is better suited to stackoverflow. Your question is now migrated there. There will be a link that appears below the question here that you can follow to the new location of your question. – Zev Chonoles Jun 14 '12 at 4:10

closed as off topic by user17762, Rahul Narain, Zev Chonoles Jun 14 '12 at 4:11

Questions on Mathematics Stack Exchange are expected to relate to math within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.