parfeval - Struct contents reference from a non-struct array object

I changed one of my programs from serial computation to parallel computation. In serial everything works fine; in parallel also most times. When I execute my program I get the following error:
Error using parallel.FevalFuture/fetchOutputs (line 139)
One or more futures resulted in an error.
Error in test_method_time_determination (line 132)
result_show{idx} = fetchOutputs(result(idx));
Caused by:
Error using pi_processing_pi (line 10)
Struct contents reference from a non-struct array object.
The strange thing is, that I get the error message just sometimes. I can run exactly the same program like ten times and once it fails and not necessarily at the same point.
I think, the problem is that the function which is processed in parallel sometimes delivers an empty result cell. My function call looks like that:
while go
result(cnt) = parfeval(@pi_processing_pi,1,ref, target, roi, analysis.intMet, analysis.subMet, sizeX, sizeY, ns_x, ns_y, analysis.ns);
//some changes in the input arguments
if something break;
end
I get the results via:
result_show = cell(1,imax);
for idx=1:imax
result_show{idx} = fetchOutputs(result(idx));
%some processing
end
The pi_processing_pi function evaluates the differences between two images and returns a Matrix. The functions are quite complex with several sub-functions. I don't think that it makes much sense to add all the functions. Moreover, the functions usually work and just from time to time a function evaluation fails (for a case which worked several times before). Does anybody have an idea why this problem occurs. I am using Matlab 2016b btw. But I have the same problem with 2017a.

1 Kommentar

Andreas Thoma
Andreas Thoma am 9 Feb. 2018
Bearbeitet: Andreas Thoma am 9 Feb. 2018
ok.. I narrowed the problem a little bit down. Apparently one of my structures "ref" which I pass to my functions fails to be created properly from time to time. When I use a breakpoint to check on ref, it is always a structure and the function runs through. But then my program never fails. But how is it possible that ref is created as a structure sometimes and sometimes not, using exactly the same code?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 9 Feb. 2018

Bearbeitet:

am 9 Feb. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by