help-octave
[Top][All Lists]
Advanced

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

Octave question: Integrating .dat files in functions?


From: StudentinCrisis
Subject: Octave question: Integrating .dat files in functions?
Date: Tue, 13 Dec 2011 00:51:07 -0800 (PST)

My wierd.dat file is this:
9
10
2
3
2
3
2

I want my program to print out the sum of this, so here's my code:
datafile = 'wierd.dat';
dlmread(datafile)

function out = fsum(datafile)
sum = 0;
for i = 1: length(datafile)
sum = sum + datafile(i);
end
out = sum;
end

But for some reason it prints out wierd.dat's exact same list. I don't
understand what to do here.

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Octave-question-Integrating-dat-files-in-functions-tp4189552p4189552.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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