Parfor: discontiguous index error

7 visualizzazioni (ultimi 30 giorni)
Leo Nunnink
Leo Nunnink il 4 Giu 2018
Hi I am trying to process a batch of 250 tables using parfor and collect summary data from each. The names of the files are contained within Filelist. I have pre-allocated all output variables. Because of other problems with parfor I turned the contents of my loop into a function. This code works fine for small values of j (say 20) but for large numbers (say 100) returns the following error: 'Cannot create a table variable with a discontiguous index.' I'm not sure why. Index variables are within the bounds of the preallocated output table. I get that parfor randomly allocates loop variables but it's not clear why this should cause a discontiguous index problem. Even if it generates the following loop variables in a row [36,27,45,17], my understanding is that these should still be able to be used as column indices to insert columns into an output table of 100 columns without causing problems. Any assistance or a workaround would be much appreciated.
NumT=array2table(zeros(size(Codes,1),size(Filelist,1))); %output array of collated T data
TotalV=array2table(zeros(size(Codes,1),size(Filelist,1))); %output array of collated V data
CurrentTCol=table(zeros(size(Codes,1),1));
CurrentVCol=table(zeros(size(Codes,1),1));
tic
parfor j=1:size(Filelist,1)
Filename=fullfile('C:\Users\etc\',string(Filelist{j,1}) );
[CurrentVCol,CurrentTCol]=CountTandV(Filename,Codes);
TotalV(:,j)=CurrentVCol(:,1); %insert current column into output array
NumT(:,j)=CurrentTCol(:,1); %insert current column into output array
end
toc

Risposte (0)

Categorie

Scopri di più su Data Type Identification in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by