Help importing mixed data

조회 수: 3 (최근 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 CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by