matlab에이 오류가 있습니다 정의되지 않은 변수 "txt"또는 클래스 "txt". 문제를 해결하기 위해 txt를 정의해야한다는 것을 알고 있습니다. 가장 큰 문제는 txt가 무엇인지 모릅니다. txt = 1 시도했지만이 작동하지 않았다. 나는 지금이 코드를 가지고있다.Matlab 정의되지 않은 변수 "txt"또는 클래스 "txt"
clr = [0 0 0 ; 1 0 0 ; 0 1 0 ; 0 0 1 ; 1 1 0 ; 1 0 1 ; 0 1 1];
style = [{'-'} {':'} {'--'} {'-.'}];
nc = 1;
ns = 1;
n = 1;
l(n) = 1;
close all
p = plot(XX,YY,'ro','MarkerFaceColor','b','MarkerSize',20);
axis equal
V = axis;
r_x = (V(2) - V(1))/ 20;
r_y = (V(4) - V(3))/ 20;
axis([V(1)-r_x V(2)+r_x V(3)-r_y V(4)+r_y]);
hold on
for i=1:airports
t(i) = text(XX(i),YY(i),['\bfA'num2str(i)],'HorizontalAlignment','Center','VerticalAlignment','Middle','Color','w');
for j= 1:airports
j=1;
if Pax(i,j) >= cplex.Param.mip.tolerances.integrality.Cur
l(n) = line([XX(i) XX(j)],[YY(i) YY(j)],'Color',clr(nc,:),'LineStyle',style{ns},'LineWidth',Flights(i,j));
nc = nc + 1;
if nc > size(clr,1)
ns = ns + 1;
nc = 1;
end
txt{n} = ['A' num2str(i) '\leftrightarrow' 'A' num2str(j) ', ' num2str(Pax(i,j)) ' Pax, ' num2str(Flights(i,j)) ' Flight(s)'];
n = n + 1;
end
end
n = (n - 1);
legend(l(1:n),txt{1:n},'Location','EastOutside');
uistack(p,'top');
uistack(t,'top');
set(gcf,'Units','Centimeters');
set(gcf,'Position',[10 2 25 16]);
txt가 두 번있다. 먼저 txt {n} = ..... 그러면 범례 함수에서 사용됩니다. 내가 TXT 무엇을 호출해야 또는 내가 해결하기 위해 어떻게해야이
예 pax (i, j)는 0 인 행렬입니다. 그래서 이것은 실제로 사실이 될 수 없습니다! –