How can I determine if specific cells within an array are empty?
1 view (last 30 days)
Show older comments
Indigo Doll
on 6 Jul 2015
Commented: Indigo Doll
on 6 Jul 2015
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 Comments
Accepted Answer
Azzi Abdelmalek
on 6 Jul 2015
Edited: Azzi Abdelmalek
on 6 Jul 2015
That means edgeXPlus is not a cell array. Use edgeXPlus(1) instead of edgeXPlus{1}
0 Comments
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!