I have the following loop :
for i=1:size(voisins1_TSP,1)
cout(i)=CalculCost(voisins1_TSP(i,:),voisins1_Indexes(i,:),voisins1_Star(i,:),ring_costs,star_costs);
end
However, voisins1_Star(i,:)
can be empty and MATLAB is not happy with that:
Index exceeds matrix dimensions.
Error inMainipulation
(line 38)cout(i)=CalculCost(voisins1_TSP(i,:),voisins1_Indexes(i,:),voisins1_Star(i,:),ring_costs,star_costs);
How would it be possible to avoid this situation?