Help importing mixed data
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
lightworks
am 26 Jun. 2015
Beantwortet: Azzi Abdelmalek
am 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!
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 26 Jun. 2015
s=importdata('myfile.aspx')
date=s.textdata
num=s.data
num=num(:,2)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!