Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with automatic files loading :/

Status
Not open for further replies.

45879

Industrial
Joined
Aug 9, 2005
Messages
2
Location
PL
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!
 
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

:/

 
Read the documentation for the "eval" function.

M

--
Dr Michael F Platten
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top