Return to Snippet

Revision: 67756
at October 27, 2014 22:03 by eiger_824


Initial Code
function sum = sumk (array , k)
    sum = 0;
    for i = 1:k
        sum = sum + array(i);
    end

end

Initial URL

                                

Initial Description
A simple function in Matlat to add the first k elements in an array

Initial Title
Add the first k elements in an array with Matlab

Initial Tags
array

Initial Language
MatLab