Help importing mixed data

1 view (last 30 days)
lightworks
lightworks on 26 Jun 2015
Answered: Azzi Abdelmalek on 26 Jun 2015
Hello,
I have files that looks like this:
07/07/1999 0.00
08/07/1999 3.60
09/07/1999 0.00
10/07/1999 0.40
11/07/1999 0.20
12/07/1999 0.40
13/07/1999 0.00
..etc
And I need to import them to Matlab. If I use load I get a 2-column array with only days in col 1 and values in col 2. I need to load them in a 4 columns array, with the 3 first columns being day, month and year.
I found that the funcion readtable makes this task a very easy thing to do, but I'm running Matlab 2009b and I don't think I have that function (I get undefined function error when trying to run it).
This is the code I tried to run:
formatSpec = '%{dd/MM/yyyy}D%f';
T = readtable('myfile.aspx','Delimiter','\t', ...
'Format',formatSpec);
I'm not sure either that's the code I needed, but as I said I don't think I even have that function. I can't get new versions of Matlab because I'm working in an office and can't install new things (And the admin is never around).
Is there another way I could import the data in that way? I also tried with importdata but I don't really understand how to use that function and I couldn't find a specific example for importing mixed data (like I found for the function readtable).
I would appreciate any help you can give me.
Thanks in advance!

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 26 Jun 2015
s=importdata('myfile.aspx')
date=s.textdata
num=s.data
num=num(:,2)

More Answers (0)

Categories

Find more on Large Files and Big Data 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!

Translated by