フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

parfor loop with strings

2 ビュー (過去 30 日間)
Martin
Martin 2018 年 4 月 29 日
コメント済み: Martin 2018 年 4 月 29 日
I have the following parfor with functions F1-F3:
S = strsplit(['hund kat jensen']);
parfor J=1:length(S)
if J==1
F1()
elseif J==2
F2()
else
F3()
end
end
This work great. But since my S is pretty huge and doesn't necessarily have the same order for each run I would prefer the following string setup:
parfor J=1:length(S)
this_J=S{J}; % so I get the string name for each J, - here hund kat jensen
if strcmp(this_J,'hund')
F1()
elseif strcmp(this_J,'kat')
F2()
elseif strcmp(this_J,'jensen')
F3()
end
end
For some reason parfor cannot handle this kind of work. Anyone have a suggestion? Thanks in advance...
  1 件のコメント
Martin
Martin 2018 年 4 月 29 日
It works, I forgot to activate the parfor instead of for after some tests. Sorry spam, I closed the question

回答 (0 件)

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by