Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Loading multiple files into MATLAB

Status
Not open for further replies.

Old Nick

Advanced Member level 1
Advanced Member level 1
Joined
Sep 14, 2007
Messages
479
Helped
68
Reputation
136
Reaction score
18
Trophy points
1,298
Activity points
4,243
matlab load multiple files

I have created several hundred text files of data (64x64 arrays). I need to load them into matlab (preferably into a 3D array - of 64x64xnumbefOfFiles.).
The file names of the data are incremantal, i.e. file_1, file_2 etc.

I am hoping there is a way of doing this with a loop.

And would it be possible to create a similar array from part of the files, it is only around 100 elements in the middle of each file that I am interested in comparing.

Cheers for any help,

Nick

Added after 1 hours 14 minutes:

I've managed to work it out, well the first part anyway.
Code:
firstFile = 1;
lastFile = 5;
nSamples = 10;
columns = 2;

for n = firstFile : 1 : lastFile

        number = num2str( n );

	file = strcat('file',number,'.dat');
	stored(:,:,n) = load( file );
end

I would still like to know if it's possible to load part of a file(array of numbers) in such a way.

Cheers,

Nick
 

load multiple files matlab

Well!

As per my little experience ... I was Unable to use the strcat strategy ... I remember it did not supported variable inside it

SO what I did was to place all the files of interest in one directory

USE dir function

and its .name Construct to read images and append them to form a two D matrix

I hope you can try the same with text files ....

I had a lot of suuccessful play reading files this way

Hope U get an idea

If u feel gud... do get me some POINTs Plz click Helped me
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top