Effacer les filtres
Effacer les filtres

Using parfor

1 vue (au cours des 30 derniers jours)
Peter
Peter le 27 Avr 2012
Hi I'm trying to use parfor this way
R=zeros(20,20,5);
parfor (i=1:5,4)
%Here is a long and complicated computation that outputs a matrix X. This matrix X will vary for different i but can fit within a 20x20 matrix
.
.
.
R(1:length(X(:,1)),1:length(X(1,:)),i)=X;
end
But Maltab will not allow me to set R this way.How can I go about this problem? Thanks

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Avr 2012
Try creating the 2D slice of R locally, and copying that to R(:,:,i).
  1 commentaire
Peter
Peter le 27 Avr 2012
Yep worked thanks a lot
I changed it by adding
temp=zeros(20,20);
temp((1:length(X(:,1)),1:length(X(1,:)),i)=X;
R(:,:,i)=X;
end

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by