×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

problem with automatic files loading :/

problem with automatic files loading :/

problem with automatic files loading :/

(OP)
Hi all!
I have this kind of a problem. I need to load 33 files such as A0.txt, A1.txt, A2.txt...A32.txt. Of course, i can do this by simply typing:

load A0.txt
load A1.txt
.
.
.
load A32.txt

But when i would like to load 100 files this solution isn't a good idea. I think for loop would be perfect, but i don't know how to merge variable with .txt extention :/ I tried this:

for i=0:1:32
  load 'A' & i & '.txt'
end

or

for i=0:1:32
  load 'A' + i + '.txt'
end

but this doesn't work :(

If anybody can help me, please answer or give a clue. Thnx!

RE: problem with automatic files loading :/

(OP)
Ok, I've managed to do it. As i read in some older topics, I've typed:

for i=0:1:32
   load(['A' int2str(i) '.txt'])
end

But how can i display the read data after opening every file?

If i take one simple file and type:

load A0.txt

Then I only need to type:

A0

And the data is being displayed, but how to do this with seweral files? When i type after the load:

['A' int2str(i)]

I recieve for example:

A0

:/

RE: problem with automatic files loading :/

Read the documentation for the "eval" function.

M

--
Dr Michael F Platten

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources