Problem using textscan to read strings with space inbetween from CSV file
Show older comments
Hi, I've got a problem when trying to using textscan to load the FX data into matlab. The columns are separated by semicolon, but the problem is that there is a space between the date and time strings in the second column. So far, I can only load the data with the following code after trying various delimiter settings:
fid = fopen('test.csv');
rawData = textscan(fid, '%s %s');
However, the outcome is that, counter mixed with date, time stamp mixed with bid/offer prices. Could any one please help me to write the code, so that the first cell contains counter, second column contains date and time, third column for bid price, and fourth for offer price?
Thanks in advance!
USD/JPY,20120102 00:00:00.307,77.023,7.055
USD/JPY,20120102 00:00:00.493,77.03,77.049
USD/JPY,20120102 00:00:05.003,77.03,77.05
USD/JPY,20120102 00:00:05.005,77.023,77.056
USD/JPY,20120102 00:00:05.006,77.024,77.056
USD/JPY,20120102 00:00:06.008,77.023,77.056
USD/JPY,20120102 00:00:06.239,77.03,77.049
Accepted Answer
More Answers (0)
Categories
Find more on Standard File Formats in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!