>> opts=detectImportOptions('data2.csv')
opts =
DelimitedTextImportOptions with properties:
Format Properties:
Delimiter: {','}
Whitespace: '\b\t '
LineEnding: {'\n' '\r' '\r\n'}
CommentStyle: {}
ConsecutiveDelimitersRule: 'split'
LeadingDelimitersRule: 'keep'
EmptyLineRule: 'skip'
Encoding: 'windows-1252'
Replacement Properties:
MissingRule: 'fill'
ImportErrorRule: 'fill'
ExtraColumnsRule: 'addvars'
Variable Import Properties: Set types by name using setvartype
VariableNames: {'time', 'Var1', 'Var2' ...
VariableTypes: {'datetime', 'double', 'double' ...
SelectedVariableNames: {'time', 'Var1', 'Var2' ...
VariableOptions: Show all 11 VariableOptions
Access VariableOptions sub-properties using setvaropts/getvaropts
Location Properties:
DataLine: 4
VariableNamesLine: 1
RowNamesColumn: 0
VariableUnitsLine: 0
VariableDescriptionsLine: 0
>> t=readtable('data2.csv',opts);
Warning: The DATETIME data was created using format 'MM/dd/uuuu HH:mm' but also matched 'dd/MM/uuuu HH:mm'.
To avoid ambiguity, supply a datetime format using SETVAROPTS, e.g.
opts = setvaropts(opts,varname,'InputFormat','MM/dd/uuuu HH:mm');
> In matlab.io.internal.text.TableParser/readData (line 75)
In matlab.io.text.TextImportOptions/readtable (line 223)
>> t(1:5,:)
ans =
5×11 table
time Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10
____________________ __________ _______ ____ ____ ____ ____ ____ ____ ____ _____
05-Jun-2018 12:00:00 1561 -200.25 2.5 2.4 6.5 7 0.1 5.6 6.8 6.1
05-Jun-2018 12:00:00 1.5613e+05 -200.25 2.5 2.4 6.5 7 0.1 5.6 6.8 6.1
05-Jun-2018 12:00:00 15661 -200.25 2.5 2.4 6.5 7 0.1 5.6 6.7 6.1
05-Jun-2018 12:00:00 1656 -200.25 2.5 2.4 6.5 7 0.1 5.6 6.8 6.1
05-Jun-2018 12:00:00 1661 -200.25 2.5 2.4 6.5 7 0.1 5.6 6.8 6.1
>>
Best Answer