function pt = plot_topology_1(filename) newfilename = [filename, '.network']; fileID = fopen(newfilename); if fileID == -1 error('Author:Function:OpenFile', 'Cannot open file: %s', newfilename); end C = textscan(fileID,'%c %d %d %f32 %f32 %f32 %f32 \n','Delimiter',',','HeaderLines',1); fclose(fileID); no_of_edges = length(C{1}) final = no_of_edges; a = C{2}; b = C{3}; edgewidth = C{5}; weights = randi([1 40],1, final); G = graph(a,b,weights) aa=incidence(G) sup=supply_nodes(aa) %function of supply nodes
dem = demand_nodes(aa) %function of demand nodes
col= [0.3 8 12 5]; d=length(col) i=0; for i=1:d if i==1 c='r'; elseif i==2 c='g'; elseif i==3 c='b'; else i==4 c='m'; end p = plot(G) highlight(p,sup, c ) % supply node color
highlight(p,dem,'NodeColor','g') %demand node color
endend
there is only one supply node in this network and is indicated by red color. I want change the supply node color step by step in four diffrerent colors following the some given values. I made an array of 1*4 for four different color. But it shows that Matlab doesn't support the function. Please help me to figure it out.
Best Answer