I've got an issue with matlab's new readmatrix function. For some reason, it has decided that my data file should be read as strings, and put into a cell array.
The data are not strings, they are doubles, and what's more, I wrote them to file using writematrix, albeit using 'WriteMode','append'. The only tricky bit about it is that the rows aren't all the same length, but it handles other files with this same property perfectly fine, padding with nans.
How can I force readmatrix to recognise the data as doubles?
Output from opts = detectImportOptions('fileName.csv'):
opts =
DelimitedTextImportOptions with properties:
Format Properties:
Delimiter: {','}
Whitespace: '\b\t '
LineEnding: {'\n' '\r' '\r\n'}
CommentStyle: {}
ConsecutiveDelimitersRule: 'split'
LeadingDelimitersRule: 'keep'
EmptyLineRule: 'skip'
Encoding: 'UTF-8'
Replacement Properties:
MissingRule: 'fill'
ImportErrorRule: 'fill'
ExtraColumnsRule: 'addvars'
Variable Import Properties: Set types by name using setvartype
VariableNames: {'x0_1'}
VariableTypes: {'char'}
SelectedVariableNames: {'x0_1'}
VariableOptions: Show all 1 VariableOptions
Access VariableOptions sub-properties using setvaropts/getvaropts
PreserveVariableNames: false
Location Properties:
DataLines: [1 Inf]
VariableNamesLine: 1
RowNamesColumn: 0
VariableUnitsLine: 0
VariableDescriptionsLine: 0
To display a preview of the table, use preview