Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Fiboehh
Posts:
8
Registered:
12/15/10


load column in from text file
Posted:
Nov 30, 2012 9:56 AM


Hello I have the following problem: I have 200 .txt files with the following structure: 0 0 2 3 ... It are kind of random numbers under each other, without a fixed amount. Now I need to do a lot of calculations with these data, but file after file: sequentiel. The results of the calculations have to come in an array, so I can do statistically analysis with the results. So I read everytime a .txt file and load them in, there the problem occurs. I can't give the data a name to use in the calculations. The loaded in numbers are stored (automatic) in a variable X... which i can't achieve for my calculations.
My code I made by the MATLAB help: close all fnames = dir('path\*.txt') for k = 1 : length(fnames) % all files dir read after each other fname = fnames(k).name; eval(['load ' fnames(k).name ' ascii']); // Calculations > B (need the data from the .txt) // result(k) = B; save('Results',result); end



