Parfor Can not convert cell to double

조회 수: 4 (최근 30일)
Burak Alakus
Burak Alakus 2020년 6월 22일
댓글: Burak Alakus 2020년 6월 22일
Hello guys.
I have a problem with parfoor loop usage.
I have cell including protein sequences and their ids. I want to consider the sequences only and i need to add sequences to the another cell.
The code below is working
i = 1
while i < length(sampleProtein)
for k=2:2:length(sampleProtein)
X(i,:) = sampleProtein(k)
i = i+1
end
end
Yet, when i use parfor it gives me an error "Conversion to double from cell is not possible"
parfor i=1:length(sampleProtein)
for k=2:2:length(sampleProtein)
X(i,:) = sampleProtein(k)
end
end
Can you guys help me out?

채택된 답변

Walter Roberson
Walter Roberson 2020년 6월 22일
parfor i=1:length(sampleProtein)
X{i} = sampleProtein{2*i};
end
  댓글 수: 4
Walter Roberson
Walter Roberson 2020년 6월 22일
But probably you should just skip the parfor and do
X = sampleProtein(2:2:end);
Burak Alakus
Burak Alakus 2020년 6월 22일
Thank you again mate. I will check it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by