Borrar filtros
Borrar filtros

Cant load large data set

2 visualizaciones (últimos 30 días)
zachary slawek
zachary slawek el 19 de Oct. de 2021
Respondida: Image Analyst el 20 de Oct. de 2021
I am trying to load a large data text file but I cant seem to get matlab to load it. I am trying : load Kenfrench4.txt; : when i try the command i get this error message:
Error using load
Unable to read file '49KenFrench2.txt'. Input must be a MAT-file or
an ASCII file containing numeric data with same number of columns in
each row.
I attached the file and I would like to know what is wrong with the file and how i can fix it, the rest of my class seemed to have no problem. Thank you for your time.

Respuestas (1)

Image Analyst
Image Analyst el 20 de Oct. de 2021
That's actually quite a small data set - maybe you only included the first 5000 rows. Anyway you can read it into a matrix or a table. I show both ways.
% Option 1 : Read it into a table.
t = readtable('Kenfrench4.txt', 'Range','A12',...
'ReadVariableNames',true);
% Option 2 : Read it into a double
data = readmatrix('Kenfrench4.txt');
% Get rid of nan rows
goodRows = ~isnan(data(:, 1));
data = data(goodRows, :);

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by