Help with turning a while loop into a parfor
이전 댓글 표시
I am trying to change my code from using a single computer to a cluster (already set up) bu tam struggling to turn an area of code from using a while to a parfor. The code is as follows-
bigBoxD = cell(1);
bbDCount = 1;
i = 1;
data = sortrows(data,'date','ascend');
while i <= height(data)
%create an empty table with headers
subset = data;
subset(:,:) = [];
%populate subset based on date
s1 = data.date(i);
tempcount = 1;
while data.date(i) == s1 && i < height(data)
subset(tempcount,:) = data(i,:);
i = i + 1;
tempcount = tempcount + 1;
end
%Stores subset in cell array
if isempty(subset)
i = i + 1;
else
bigBoxD{bbDCount} = subset;
bbDCount = bbDCount + 1;
i = i + 1;
end
end
I understand that the issue is in how I'm storing data in the "bigBoxD" variable, which after this loop goes for further processing. Is there a way I can continue to store the data in this cell array and use a parfor loop to generate it?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!