Index in position 2 exceeds array bounds error

This code was working really well until I tried to run a data set with 35 different data files. It won't run when n=26, so only the first 25 data sets are imported. My last full data set had 25 data sets within so is it affected by this somehow? Any ideas on how to fix this? Thanks!
recycle on
clearvars
dir = ".../Data Dump/Process Data/";
file_type = '*.asc';
%%%create datastore
Datastore = datastore(dir+file_type,"ReadSize","file","VariableNames",["wavenumber","intensity","rand"]);
reset(Datastore)
nfiles = length(Datastore.Files);
file_names = erase(Datastore.Files,dir)';
%%%create cell array of all data. wavenumber and intensity data for each
%%%data point are located in the each cell array. the number of cells is
%%%the nubmer of data points
All_Data = cell(1,nfiles);
for n = 1:nfiles
T = importdata(file_names{n});
All_Data{n} = T(:,[1 2]);
end

6 件のコメント

Aquatris
Aquatris 2024 年 3 月 6 日
When you say it does not run, what error message do you get?
Mathieu NOE
Mathieu NOE 2024 年 3 月 6 日
hello
stupid question, but do the extra asc files differ from the first 25 ?
Jaclyn Rebstock
Jaclyn Rebstock 2024 年 3 月 6 日
The error message is “index in position 2 exceeds array bounds”
Jaclyn Rebstock
Jaclyn Rebstock 2024 年 3 月 6 日
Every ASC file contains time dependent data at different conditions
Jaclyn Rebstock
Jaclyn Rebstock 2024 年 3 月 6 日
So in this data set I took more data than the last. I’ve been using this for lots of data sets so I’m surprised it just stopped by working no matter the length of the data set
Mathieu NOE
Mathieu NOE 2024 年 3 月 6 日
Could you share thise asc files ? maybe you could zip them

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

タグ

質問済み:

2024 年 3 月 6 日

コメント済み:

2024 年 3 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by