readmatrix behaviour is unpredictable

2 vues (au cours des 30 derniers jours)
Phillip Brown
Phillip Brown le 24 Juin 2020
I've started using readmatrix as it is recommended instead of csvread and dlmread - I actually like that it pads with nans, but at the minute that's all I like.
In the past couple of weeks since I started using it, twice have I got weird unpredictable behaviour.
I fixed the first problem (it was skipping the first n lines for random files) by setting DelimitedTextImportOptions.
Now it is reading data into cell arrays instead of regular arrays. I've no idea why it should do that, I wrote to file using writematrix...
Anyway, how can I force readmatrix to read into an array of doubles?

Réponses (1)

Urmila Rajpurohith
Urmila Rajpurohith le 30 Juin 2020
you can try :
M = readmatrix(filename,'OutputType','double')
Refer to the below documentation for more information on namevalue pair arguments of "readmatrix" function.

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by