From: "Hanah " <>
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$>
References: <hb6otr$oq4$> <hb9c01$32e$> <hbn2eo$p1$> <hbp3cn$n2i$>
Reply-To: "Hanah " <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1283430919 4610 (2 Sep 2010 12:35:19 GMT)
NNTP-Posting-Date: Thu, 2 Sep 2010 12:35:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2459764
Xref: 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:

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)

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!