Counter inside parfor loop
古いコメントを表示
Hi everyone, I need to create a counter inside a parfor loop. This counter is necessary in order to save the workspace of each iteration and to give at each workspace an increasing name like: workspace1, workspace2 and so on. However Matlab give me an error due to the fact that in parfor loop each loop is solved independtly from the others. Below I report a matlab script example. Anyone can help me??
parentdir = 'C:\Users\Stefanoo Menicanti\Dropbox\Stefano Menicanti\Matlab\File Script\NEW\Configuratore\Math_Script'; %parent directory
j=1;
parfor r= 1:3
for i = [100 200 300]
for frontal_section = 36
for layer = 2
for turn_per_layer = 5:10
for x = 0.22
for a = 0.66
for d_s_1 = 0.05
for d_s_2 = 0.05
[diso_min,dins_int1,dins_1,dt_1,Irms1,Irms1_1,nsh_1,nsv_1,Ns1,hb_1,wb_1,hw,W1,dt_2,dins_int2,Irms2,Irms2_1,nsh_2,nsv_2,Ns2,Nl_2,m2,hb_2,wb_2,dins_2,W2,dc_1,dc_2,MLT1,diso,MLT2,MLTiso,Ac,B,H,G,Vc,V_cl,V_sl_y,Lbox,Wbox,Hbox,Vbox,power_density,Pc_s,Pc,P_cl,P_sl_y,Rth_cl,Rth_LV_cl,Rth_iso,Rth_pol_LV,Rth_pol_HVr,Rth_pol_HVz,Rth_hs_LV,Rth_hs_HV,Rth_hs_sl_y,Rth_hs_amb,Aconv_HV,Arad_HV,Aconv_sl,Arad_sl,Lconv_HV,Lconv_sl,Pw1_r,Pw2_r,Pwt_r,Ploss,T_sl_r,T_HV_r,T_LV_r,T_cl_r,T_sl_y_r,T_B_HS_r,efficiency] = Procedure_with_litz_wire_strand_imposed_by_user_prova_parfor(Pout,Vdc_1,Vdc_2,n_cells,s_c,Vdc_1_cell,Vdc_2_cell,n,Viso,fsw,T,Ta,Tmax,d,phi,Lk,core_material,Bsat,kc,alpha,beta,Kc,rho_core,kcore,Ec,Tmax_core,Eins,Eins_b,Tconductivity_b,Epol,r,i,s,frontal_section,layer,turn_per_layer,x,a,d_s_1,d_s_2);
if (T_HV_r <= Tmax)&&(T_LV_r <= Tmax)&&(T_sl_r <= Tmax_core)&&(diso>= (diso_min))
Iteration = j;
parsave(fullfile(parentdir,['work_space',num2str(Iteration),'.mat']),diso_min,dins_int1,dins_1,dt_1,Irms1,Irms1_1,nsh_1,nsv_1,Ns1,hb_1,wb_1,hw,W1,dt_2,dins_int2,Irms2,Irms2_1,nsh_2,nsv_2,Ns2,Nl_2,m2,hb_2,wb_2,dins_2,W2,dc_1,dc_2,MLT1,diso,MLT2,MLTiso,Ac,B,H,G,Vc,V_cl,V_sl_y,Lbox,Wbox,Hbox,Vbox,power_density,Pc_s,Pc,P_cl,P_sl_y,Rth_cl,Rth_LV_cl,Rth_iso,Rth_pol_LV,Rth_pol_HVr,Rth_pol_HVz,Rth_hs_LV,Rth_hs_HV,Rth_hs_sl_y,Rth_hs_amb,Aconv_HV,Arad_HV,Aconv_sl,Arad_sl,Lconv_HV,Lconv_sl,Pw1_r,Pw2_r,Pwt_r,Ploss,T_sl_r,T_HV_r,T_LV_r,T_cl_r,T_sl_y_r,T_B_HS_r,efficiency);
j = j+1;
end
end
end
end
end
end
end
end
end
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および 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!