Parfor Loop Error [Struct contents reference from a non-struct array object]

Hello everyone,
I get an error [Struct contents reference from a non-struct array object] transforming my standard for-loop (tested) into a parfor-loop. The error occurs within this function:
function [template,best,messages]=Rotan(analy)
...
parfor i01=1:version
Rot = rotfe(template(i01));
[~,lambda]=roteig(Rot,1);
template(i01).CRIT_SPEED=abs((lambda(1)))/2/pi*60;
end
The template file is created from the input (analy) within this function as well as the variable version. 'template' and the input 'analy' are structs and roteig and rotfe are self-defined functions. Evereything works fine in a normal for-loop.
Thank you

2 件のコメント

Jan
Jan 2018 年 10 月 8 日
What is hidden behind "..."? Do you pre-allocate the struct template? What is "version"? Which line causes the error? Please post a copy of the complete message.
Robin Duhnsen
Robin Duhnsen 2018 年 10 月 8 日
It is a really long programm but I fixed it. The problem was that I didn’t declare the new field of the strict (template.CRIT_SPEED) before the loop. Thank you though

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2018 年 10 月 8 日

コメント済み:

2018 年 10 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by