How do I read multiple csv from one folder and acess them in one in matlab

3 ビュー (過去 30 日間)
Reena Popat
Reena Popat 2020 年 5 月 27 日
編集済み: Cris LaPierre 2020 年 5 月 28 日
Hello there,
Can sombody tell me how do I read n access multiple files in matlab and also how do I know that the data from all files are all read? I have 74 csv files and I used bellow code and I got result in workspace but didnt get whole data.
pth = 'C:\Users\amris\Downloads\data new\'; % directory of the folder, where data files are saved
liste = dir(strcat(pth,'*.csv'));
files = {liste.name};
for k = 1:numel(files)
file{k} = strcat(pth,files{k});
data{k} = importdata(file{k},' ',74);
end

回答 (1 件)

Cris LaPierre
Cris LaPierre 2020 年 5 月 28 日
編集済み: Cris LaPierre 2020 年 5 月 28 日
Do you want to keep each data file separate? If instead you want to combine all the data into a single variable, consider using a datastore. You can see an example of how to use datastore to do this in this video from the Data Processing with MATLAB specialization on Coursera.

カテゴリ

Help Center および File ExchangeUse COM Objects in MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by