hi,
Let say i have 6 files: 101 … 103 and 201 … 203 which represent 2 people (p) with 3 different expressions(e). After using 'dir' to gel all the files, i try to create a cell (2×3). However i got an error ' Improper index matrix reference '. Below is the code:
FolderTrain = 'myfolderpath'; %specify the folder
AllTrainFiles = fullfile(FolderTrain, '*.txt'); % get the directory path for all files
myData = dir(AllTrainFiles);for i=1:length(myData) j=2; k=3; TrainData = cell(j,k);end
cell
for p = 1:j for e = 1:k baseTrainFilename = {TrainData(p,e).name}; TrainFilename = fullfile(FolderTrain, baseTrainFilename); fid = fopen(TrainFilename); A = fscanf(fid, '%d %d %d'); TrainData{p,e} = A; fclose(fid); endend
How can i create a correct 2×3 cell? Thank you.
Best Answer