How can I determine if specific cells within an array are empty?

I am writing a program to collect certain numbers within an array, but I want to pass over the cells that are empty.
I keep getting the error "Cell contents reference from a non-cell array object. Error in 'if isempty(edgeXPlus{i})'"
I've looked at other people's code and this line seems to work for them, but I can't figure out why it doesn't work in my code.
for i = 1:(number)
if (isempty(edgeXPlus)) %%ensures that the array has values
else
if isempty(edgeXPlus{i}) %%ensures that the cell has a value
else
if(edgeXPlus(i) >= xUpper) %%checks to see if these values are within the correct range
count = count + 1;
edgeX(count) = edgeXPlus(i) %%if one is, it is assigned to 'edgeX'
end
end
end
end

댓글 수: 2

What is class(edgeXPlus)?
An array of x-values corresponding to a y-value specified earlier in the code. I think I solved the problem.

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

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 6일
편집: Azzi Abdelmalek 2015년 7월 6일

0 개 추천

That means edgeXPlus is not a cell array. Use edgeXPlus(1) instead of edgeXPlus{1}

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

태그

질문:

2015년 7월 6일

댓글:

2015년 7월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by