sliced variables
Afficher commentaires plus anciens
I intend to write a value, say, 90, in many times, say 15 (actually want it in 1440 times) inside a parfor loop.
The first approach using for loop generated this error - 'valid indices for 'a' are restricted in PARFOR loop'
parfor n=1:35
a=zeros(:,15); % the variable is indexed but not sliced
for k=1:15
a(:,k)= 100
end
end
the second approach (vectorization)
parfor n = 1:35
a=zeros(:,15); % the variable is indexed but not sliced
a(:,1:15)=90;
end
generated same error and so PARFOR loop cannot run due to the way variable 'a' is used.
I want to actually slice the variable 'a' not just indexed so as to avoid unnecessary communication overhead, please how do I go about this? Kindly assist.
Felix
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 16 Jan 2012
0 votes
zeros(:,15) is not valid syntax to call the zeros() function.
1 commentaire
Facosoft
le 17 Jan 2012
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!