Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

how can I display number on city locations ?

Asked by Yogesh Shukla on 23 Apr 2013
     figure('Name','City Locations','Numbertitle','on');
        plot(xy(:,1),xy(:,2),'bo');
                     ...........  ........
                     .........  ..........
                 figure(pfig);
            route = best_route([1:n 1]);
            plot(xy(route,1),xy(route,2),'b.-');
            title(sprintf('Total Distance = %1.4f, Iteration = %d',min_dist,iter));

0 Comments

Yogesh Shukla

Products

No products are associated with this question.

1 Answer

Answer by the cyclist on 23 Apr 2013
Edited by the cyclist on 23 Apr 2013

You could use the text() function.

>> doc text

for details.

1 Comment

Yogesh Shukla on 23 Apr 2013

i this segment figure doesnt appear when I use text function.

 for p = 1:population
        d = distance_matrix(pop(p,n),pop(p,1));
        for k = 2:n
            d = d + distance_matrix(pop(p,k-1),pop(p,k));
        end
        total_dist(p) = d;
    end
    [min_dist,index] = min(total_dist);
    dist_history(iter) = min_dist;
    if min_dist < global_min
        global_min = min_dist;
        best_route = pop(index,:);   
            figure(pfig);
            route = best_route([1:n 1]);
            plot(xy(route,1),xy(route,2),'b.-');
            title(sprintf('Total Distance = %1.4f, Iteration = %d',min_dist,iter));
    end
    rand_pair = randperm(population);
the cyclist

Contact us