필터 지우기
필터 지우기

read and use the ith matrix for the ith determiner

조회 수: 1 (최근 30일)
Homayoon
Homayoon 2016년 3월 22일
편집: Stephen23 2016년 3월 22일
Hello All,
I want to use parfor loop to speed up my calculations. However I am stuck at a point. for each determiner, a certain predefined matrix has to be used. Please be advised that the matrices are not dimensional equal so that I cannot combine them all together.
Assume I have matrices R1, R2 and R3 with totally different dimensions. I want to do the following:
parfor i=1:3
read matrix Ri % I do not know how to do this part
my calculations
end
What should i do? Thank you so much

채택된 답변

Stephen23
Stephen23 2016년 3월 22일
편집: Stephen23 2016년 3월 22일
Easy: put the matrices into one cell array. This is a fast and reliable way to program:
C = {R1,R2,R3}; % <- one cell array
parfor k = 1:numel(C)
C{k}
end
And DO NOT try to access those arrays using dynamic variable names. That would be a slow and buggy way to program, that beginners seem to love no matter how slow and buggy it is:
  댓글 수: 1
Homayoon
Homayoon 2016년 3월 22일
I am really grateful Stephen. It inspires an awe :D Thanks

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

추가 답변 (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