Serving the Quantitative Finance Community

 
User avatar
mounphys
Topic Author
Posts: 0
Joined: April 11th, 2008, 9:30 pm

Trivial question on Matlab

January 7th, 2009, 2:38 pm

Hi guys,as a newbie, I have a very trivial question about matlab.I want to import a .csv file in matlab. This file contains both text and numbers and this seems to cause problems with the Matlab "import wizard".The problem is that Matlab does not seem to read commas as symbols for separating columns, thus each row in the imported field appears to be made by one single text column.Hope I could explain myself.Any suggestion?Thanks a lot in advance.
 
User avatar
Martinghoul
Posts: 188
Joined: July 18th, 2006, 5:49 am

Trivial question on Matlab

January 7th, 2009, 2:49 pm

That's actually non-trivial. Take a look here:readtext
Last edited by Martinghoul on January 6th, 2009, 11:00 pm, edited 1 time in total.
 
User avatar
Yossarian22
Posts: 4
Joined: March 15th, 2007, 2:27 am

Trivial question on Matlab

January 7th, 2009, 3:35 pm

Hi, The way I solve that problem is to write a tiny four/five line perl script to extract the data I want to import. Then I run system('perscript.pl') in matlab. Y
 
User avatar
spursfan
Posts: 2
Joined: October 7th, 2001, 3:43 pm

Trivial question on Matlab

January 7th, 2009, 3:53 pm

Ah, the joys of MATLAB - a 450 line "work-round" function to do something that the program should do automatically
 
User avatar
Martinghoul
Posts: 188
Joined: July 18th, 2006, 5:49 am

Trivial question on Matlab

January 7th, 2009, 3:58 pm

QuoteOriginally posted by: spursfanAh, the joys of MATLAB - a 450 line "work-round" function to do something that the program should do automaticallyWell, there's lots of comments...
 
User avatar
chaz1858
Posts: 0
Joined: August 23rd, 2007, 3:32 am

Trivial question on Matlab

January 7th, 2009, 9:05 pm

Regarding the textread function, is there a way to import the data into a single matrix rather than separating it into three arrays? How come Matlab fails to import a ASCII text file with the date in the following format (19940105)? Is there a way I can just treat the date as a numeric data type?Are there any add-ons for Matlab that will do this for me automatically?
 
User avatar
midastouch
Posts: 0
Joined: September 13th, 2004, 12:43 pm

Trivial question on Matlab

January 15th, 2009, 1:07 am

try using:importdata('filename','whatever your delimiter')