whileループからparforループへの変換
이전 댓글 표시
forループ文をparforループを使用して時間の短縮を行いたいです。
コード本文は1次元csvに対して3000ずつ1データずらしでで切り取りを行っているのですが、forをparforに変更した際にこういったエラーが出ます。
parfor文のドキュメンテーションを見てもいまいちピンと来ないのでどこが間違っているのかご教授願いたいです。
原文
data = csvread('C:\Users\test\.csv'); % Put Data
data = transpose(data);
G = gpuArray(data);
L = length(data);
S = 3000; % Space
K = L-S+1;
for n =1:L-S+1;
t = data(n:n+S-1);
filename = ['C:\Users\test\test',num2str(n),'ch2.csv']; % Put Data name 'test'
csvwrite(filename, t);
n = n + 1;
end
エラー文
Error:Assigning to the loop variable "i" of a parfor is not allowed.
See Parallel for Loops in MATLAB, "Loop Variable".
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 ループと条件付きステートメント에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!