help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with m-file


From: Jordi Gutierrez Hermoso
Subject: Re: problem with m-file
Date: Fri, 24 Nov 2006 14:34:46 -0600

On 24/11/06, Marco Hippler <address@hidden> wrote:
i've written an m-file test1.m

%m File
function summe=test1(A)
[m,n]=size(A);
summe=0;
for x=1:m
        for y=1:n
                summe=summe+A(x,y);
        end
end

Btw, I know this is just test code, but you do know that it's much
better to write

    summe = sum(sum(A))

instead of two for-loops, right?

Curious,
- Jordi G. H.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]