How can I Ensure Transparency in parfor-Loops when using cell2table ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Marina-Effrosyni Panteli
el 7 de Nov. de 2022
Comentada: Marina-Effrosyni Panteli
el 7 de Nov. de 2022
I am using parfor which contains a for loop and in it I have:
ranked_global_firstorder=sortrows(empty_cell_fo,[2],'descend');
ranked_global_firstorder=cell2table(ranked_global_firstorder);
ranked_global_firstorder.Properties.VariableNames=["m","ranked_global_first_order"];
descending_per_Ns_fo(:,k-1)=[table(m);ranked_global_firstorder(:,1)];
I am getting the following error:
Error using cell2table (line 39)
Transparency violation error.
See Ensure Transparency in parfor-Loops or spmd Statements.
If anyone can offer any insight into how I can solve this, I would be very grateful. I am new to parfor and while I did read certain stackexchange pages, I cannot figure it out. Thank you very much in advance. Cheers.
2 comentarios
Walter Roberson
el 7 de Nov. de 2022
Which MATLAB version are you using? What is the name of the file you stored this code in? And please check whether the cell you are passing in is possibly empty.
Respuestas (1)
Edric Ellis
el 7 de Nov. de 2022
Most of the table-building functions can have this problem if you do not specify 'VariableNames', like this (tested in R2019a):
parfor i = 1
c = {1, "foo";
2, "bar";
3, "baz"};
t{i} = cell2table(c, 'VariableNames', {'numbers', 'words'});
end
disp(t{1})
Ver también
Categorías
Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!