E = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
E1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
e = 1;
E(1) = U{1}(1);
e = e + 1;
e1 = 1;
E1(1) = U{1}(2);
e1 = e1 + 1;
for i = 1:numel(U)
a = U{i};
for t = 1:numel(E)
if a(1) == E(t);
E1(e1) = a(2);
e1 = e1 + 1;
else if a(2) == E(t);
E1(e1) = a(1);
e1 = e1 + 1;
end
end
end
help pls how can i define it

댓글 수: 1

Stephen23
Stephen23 2017년 12월 14일
@Evaldas Kuslevic: today I formatted you code correctly for you. In future you can do it yourself: first select the code, then click the {} Code button.

댓글을 달려면 로그인하십시오.

 채택된 답변

Jan
Jan 2017년 12월 14일
편집: Jan 2017년 12월 14일

0 개 추천

Let me guess, what your question might mean: The message
Undefined variable "U"
is shown, when you try to run this line:
E(1) = U{1}(1);
Then the message is clear: The variable "U" is not existing yet. The posted piece of code does not clarify where this variable might be coming from.
Speculation: Perhaps you have defined U in the inputs, but started the function using the "Start" button (the green triangle). This cannot work, because the input must be provided to define U.

추가 답변 (1개)

Evaldas Kuslevic
Evaldas Kuslevic 2017년 12월 14일

0 개 추천

ah.. thanks so much!

카테고리

도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기

제품

태그

질문:

2017년 12월 14일

답변:

2017년 12월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by