Undefined variable for plotting if statement array

조회 수: 4 (최근 30일)
Takrim Bhuiyan
Takrim Bhuiyan 2018년 4월 12일
답변: Walter Roberson 2018년 4월 12일
I have a script where I'm taking values from an array and plotting the values that satisfy an if condition. But for some reason it claims that one of the variables is undefined even though I defined it under the if statement. When I look at the error message at the line, it says that the variable xplot appears to change size after every iteration. How do I resolve this?

답변 (1개)

Walter Roberson
Walter Roberson 2018년 4월 12일
If lowDistidx never becomes true, then you might never assign anything into xplot or yplot.
We cannot tell from what you posted whether possibly hdiff is a vector -- in which case the condition might be true for some of its members but false for other of its members.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by