필터 지우기
필터 지우기

Using parfor

조회 수: 1 (최근 30일)
Peter
Peter 2012년 4월 27일
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

채택된 답변

Walter Roberson
Walter Roberson 2012년 4월 27일
Try creating the 2D slice of R locally, and copying that to R(:,:,i).
  댓글 수: 1
Peter
Peter 2012년 4월 27일
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

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by