フィルターのクリア

Cant load large data set

2 ビュー (過去 30 日間)
zachary slawek
zachary slawek 2021 年 10 月 19 日
回答済み: Image Analyst 2021 年 10 月 20 日
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.

回答 (1 件)

Image Analyst
Image Analyst 2021 年 10 月 20 日
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, :);

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by