The first input-argument to exportgraphics is supposed to be a handle to any type of axes. The handle you send in might very well be lost in the plotting function-calls you perform after you generate it. Maybe you get the proper handle to the current axes if you use an output-argument to the borders call in the loop:
bord = borders('countries','r');
borders('countries','facecolor',[0.85,0.85,0.85])
axis tight
%W
for k=1:size(genepy_W_W_pred,1)
if genepy_W_W_pred.dummy_W(k)==1 %se è W_pred
bord = borders(cell2mat(genepy_W_W_pred.ctry_W_W_pred(k)),...
'facecolor',genepy_W_W_pred.color(k,:));
end
end
exportgraphics(bord,'genepy_hs4_W_HQ.jpg','Resolution',500)
What are the benefits of using exportgraphics instead of print?
HTH