Index in position 1 exceeds array bounds. Index must not exceed 1200. i am getting this error.

2 views (last 30 days)
I want matlab to collect all the 1201 no data of 117 csv files on that folder and make a new csv file which will do as the new features.
close all
clear all
file_location ='D:\Conference August\Data\0_Subjects_Empty Room' ;
emptyroomdata = fileDatastore(fullfile(file_location),'ReadFcn',@importdata,'FileExtensions','.csv')
fullFileNames = emptyroomdata.Files ;
numfiles = length(fullFileNames)
data = readall(emptyroomdata) ;
maxi = [];
mini = [];
kur = [];
ske = [];
stan = [];
for k = 1:numfiles
h = data{k,1}.data(1201,:) ;
maxx = max(h) ;
minn = min(h) ;
kurt = kurtosis(h) ;
skee = skewness(h) ;
stdd = std(h) ;
maxi = [maxi, maxx] ;
maximum = maxi.' ;
mini = [mini, minn] ;
minimum = mini.' ;
kur = [kur, kurt] ;
kurto_sis = kur.' ;
ske = [ske skee] ;
skew_ness = ske.' ;
stan = [stan, stdd] ;
standard_deviation = stan.' ;
end
  4 Comments

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 29 Aug 2022
Position 1 is your row index. Apparently, data only has 1200 rows, and your code is trying to extract row 1201.
% simple example
a = [1 2;3 4]
a = 2×2
1 2 3 4
% works
a(2,:)
ans = 1×2
3 4
% your error
a(3,:)
Index in position 1 exceeds array bounds. Index must not exceed 2.

Community Treasure Hunt

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

Start Hunting!