Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Importing several CSV files at the same time (600 or more)
Date: Mon, 1 Oct 2007 19:33:20 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <fdri20$q3$1@fred.mathworks.com>
References: <5497789.1191252685630.JavaMail.jakarta@nitrogen.mathforum.org>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-06-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1191267200 835 172.30.248.36 (1 Oct 2007 19:33:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 1 Oct 2007 19:33:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1030060
Xref: news.mathworks.com comp.soft-sys.matlab:430884



BO <bianca_osorio@hotmail.com> wrote in message
<5497789.1191252685630.JavaMail.jakarta@nitrogen.mathforum.org>...
> Hey! i need to import around 400-600 csv files to the
workspace at the same time so i can take the data in those
file and graph it, the issue is that i have to this trough a
Gui, and using uiimport takes a lot of time. Is there a way
that i can import that many files, and let the user of the
gui select de directory and the number of files.
> type of files: CSV files, with 3 colums each colum a
variable with around 8192 points.

This code doesn't include a feature for limiting the number
of files in a directory, but you could add that easily:

%let user select directory from UI, 
%and pass this directory as a parameter
function ProcessFiles(directory)	
	allFiles = dir(directory);
	for k = 1 : length(allFiles)
		if(strfind(allFiles(k).name, '.csv'))
			processFile([directory '\' allFiles(k).name]);
		end
	end
end