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?

 Réponse acceptée

Walter Roberson
Walter Roberson le 22 Juin 2020
parfor i=1:length(sampleProtein)
X{i} = sampleProtein{2*i};
end

4 commentaires

Burak Alakus
Burak Alakus le 22 Juin 2020
Thank you mate. It is worked. Really appreciated.
Walter Roberson
Walter Roberson le 22 Juin 2020
The upper bound should probably be length(SampleProtein)/2
But probably you should just skip the parfor and do
X = sampleProtein(2:2:end);
Burak Alakus
Burak Alakus le 22 Juin 2020
Thank you again mate. I will check it.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by