Path: news.mathworks.com!not-for-mail
From: "Hanah " <zadonix@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: reading alphanumeric data
Date: Thu, 2 Sep 2010 12:35:19 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <i5o5m7$4g2$1@fred.mathworks.com>
References: <hb6otr$oq4$1@fred.mathworks.com> <hb9c01$32e$1@fred.mathworks.com> <hbn2eo$p1$1@fred.mathworks.com> <hbp3cn$n2i$1@fred.mathworks.com>
Reply-To: "Hanah " <zadonix@yahoo.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1283430919 4610 172.30.248.37 (2 Sep 2010 12:35:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 2 Sep 2010 12:35:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2459764
Xref: news.mathworks.com comp.soft-sys.matlab:667129

Hi Branco,

I was led here by my search to resolve a problem I have with reading data into MATLAB; I written a couple of routines and have tried some of the suggestions you have on her but none seems to pan out. 

I have a cv file, testa, with 46 (sans header) rows x 25 columns of alphanumeric data:
http://hotfile.com/dl/66495316/438d04c/testa.csv.html

My goal is I to extract data (rows) corresponding to selected dates, times, expirations, strikes, etc & process them. My hence, my end result should be a 46 x 25 matrix of data for which I can select rows given a criteria (e.g. date) and execute operations on numeric data.

Here's what I have written so far:
...
fid = fopen('testa.csv','rt');
C = textscan(fid,'%s','delimiter','[]','headerlines',1)
fclose(fid);

data = cat(1, C{:});

string_data = regexp(data,'([A-Z a-z]+)','match');
string_data = cat(1,string_data{:}); 
numeric_data = regexp(data,'([0.00-9.99]+)','match');
numeric_data = cat(1,numeric_data{:});
...

However, my string_data matrix has a size of 46 x 4, instead of 46 x 3 (2nd row is blank). Also, my numeric_data matrix is 46 x 28 instead of 46 x 22 (the date fields get split further for some weird reason). I'm not sure what I'm doing wrong here and would appreciate a sanity check. Can you please take a look?

What I'm basically trying to do is load the data into MATLAB, and select all rows corresponding to different column parameters, and process the data withing those rows, etc. The end result should be a 46 x 25 operable matrix as close to the original data format as possible. 

Thanks a lot for the help!

Han