Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: load column in from text file
Replies: 12   Last Post: Dec 11, 2012 3:47 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 8
Registered: 12/15/10
Re: load column in from text file
Posted: Nov 30, 2012 10:23 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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

I hope you can help me.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.