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
|
|
Re: load column in from text file
Posted:
Nov 30, 2012 10:23 AM
|
|
"Nasser M. Abbasi" <nma@12000.org> wrote in message <k9ai2f$3ij$1@speranza.aioe.org>... > On 11/30/2012 8:56 AM, Fiboehh wrote: > > > eval(['load ' fnames(k).name ' -ascii']); > > what is the deal with this eval thing? why not write normal > code and just call the function load() directly? > > Any reason you must do it this way? > > As for your question, > > >> I can't give the data a name to use in the calculations. > > may be you can simply use importdata? > > A=importdata('myfile.txt'); > or A=load(.....) > > and here is your variable. > > For text files better to use textscan or importdata I would think. > > --Nasser >
Thanx for the reply Nasser, The solutions you gave, work for only one 'direct' path file. I need to do this for all my files, so I 'm not planning to change 200 times the 'myfile.txt' name. The eval(['load ' fnames(k).name ' -ascii']); code I use to give the correct file (which is a string (converts number to string)), because the code below can't recognize the files correct.
for k = 1 : length(fnames) fname = fnames(k).name; log = impordata('fname.txt'); // fname is variable so this gives a problem disp(log) end
I hope you can help me.
|
|
|
|