Help importing mixed data

1 回表示 (過去 30 日間)
lightworks
lightworks 2015 年 6 月 26 日
回答済み: Azzi Abdelmalek 2015 年 6 月 26 日
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!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 6 月 26 日
s=importdata('myfile.aspx')
date=s.textdata
num=s.data
num=num(:,2)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by