loading specific files from folder into a data store

조회 수: 9 (최근 30일)
Doron Joffe
Doron Joffe 2021년 11월 28일
답변: Image Analyst 2021년 11월 28일
I have 100 different csv in a folder and 100 in a second folder. i used the following code to load 6 specific files from each folder:
files =[dir(filename1);dir(filename2);dir(filename3);dir(filename4);dir(filename5);dir(filename6)];
sheets =[dir(filename1);dir(filename2);dir(filename3);dir(filename4);dir(filename5);dir(filename6)];
Is there a way to combine 'files' and 'sheets' into a single structure or table? Alternatively, I know that if I load the files in two datastores I can use the combine tool. But is there a way to specify specific files to be loaded from a folder like I have done here?

답변 (1개)

Image Analyst
Image Analyst 2021년 11월 28일
Yes. The "Files" field of the datastores contains the full filenames. You can extract only the ones you want (like the first 6) and combine into a cell array.

카테고리

Help CenterFile Exchange에서 Workspace 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