How to convert table to an array when the first two variables are different?
Show older comments
Hello I have been working with this data set for a while and cannot get matlab to read it. The data consists of 8 variables and the first 2 are different. I will post my code and the error as well as what the data looks like.
date time pressure seatemp airtemp buoyhead windspd winddir
07/24/1994 12:00:00 1018.05 28.55 30.05 39.38 3.40 38.31
07/24/1994 13:00:00 1018.20 28.85 30.50 25.31 2.80 39.71
07/24/1994 14:00:00 1018.05 29.15 29.75 12.66 4.80 24.24
My code:
T=readtable('m17cm17.nodc','FileType','text','HeaderLines',57);
%%convert to an array
A = table2array(T)
Error: Cannot concatenate the table variables 'Var1' and 'Var2', because their types are datetime and cell.
4 Comments
Image Analyst
on 14 Apr 2017
You forgot to attach 'm17cm17.nodc'. Come on, make it easy for us to help you, not hard.
andrea molina
on 14 Apr 2017
Stephen23
on 14 Apr 2017
@andrea molina: that just looks like a text file. Upload it after checking the file extension to .txt. Then we can help you.
andrea molina
on 15 Apr 2017
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Identification 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!