Error with parfor loop
조회 수: 10 (최근 30일)
이전 댓글 표시
Hi there, I am trying to run the following:
INPUT:
parfor i=1:1:5
data(i)=IBMatlab('action','query','symbol','EUR','localSymbol', 'EUR.USD', 'secType', 'cash', 'exchange', 'idealpro');
price(i)=data(1,i).bidPrice(1,1);
end
OUTPUT:
??? Error: The variable data in a parfor cannot be classified. See Parallel for Loops in MATLAB, "Overview".
Any help anybody? WHEN I USE NORMAL FOR LOOP IT WORKS.
댓글 수: 2
채택된 답변
Edric Ellis
2012년 2월 20일
You need to ensure that you're indexing 'data' in a consistent manner inside the PARFOR loop. It should work to make both references either 'data(1,i)' or 'data(i)'.
댓글 수: 1
David Allen
2012년 6월 11일
To make this clear, as the help file is poor on this. You need something like this:
z(s).a= ....
z(s).b=.....
This one drove me mad.
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!