
indata = zeros(1,365*10);      % allocate storage for the data

infile = fopen('Nestle.csv','rt');  % open the file text for reading
tline  = fgetl(infile);        % read the title lines
tline  = fgetl(infile);        

k = 0;                        % a counter
inline = fgetl(infile)        % read a line
while (~isscalar(inline))     % test for end of input file (Octave)
  counter = find(inline==';');% find the first ','
			      % then consider only the rest of the line
  newline = inline(counter(2)+1:length(inline));
                              % read the numbers
  A = sscanf(newline,'%f%c%f');
  k = k+1;
  indata(k) = A(1);           % store only the first number
  inline = fgetl(infile);     % get the next input line
end
fclose(infile);               % close the file
indata = indata(1:k);         % use only assigned values
disp(sprintf('Number of trading days from 1997 to 2007 is %i',k))
plot(indata)
grid on
