Exclude from plotting some coordinates (born from blank .png images)
10 views (last 30 days)
Show older comments
Hello! Maybe the title will not be well clear but I hope I am clear in my goal.
I have the attached code along with some .png figures.
What I want to achieve is the figure below though with the exclusion of those nodes that are created when a "white" .png image is read (.png image with no black curve).
I also want to keep the position of the white .png image with that Y coordinate (z in the code).
I had thought about the "isempty" command but I am not clear where and how to use it in my code (and also if it is suitable to use it).
I hope I have been clear. I thank to those who can help me.

1 Comment
Fifteen12
on 19 Dec 2022
Hi Alberto, I'm not sure I know what you're trying to do--are you trying to parse PNGs? How are these nodes arising? Can you share more information about what is causing these nodes to occur?
Accepted Answer
DGM
on 19 Dec 2022
One simple way to skip plotting those cases would be to just do this modification:
for k = 1:length(imageFiles)
baseFileName = imageFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf('Now reading %s\n', fullFileName);
imageArray = imread(fullFileName);
binaryImage = imageArray;
binaryImage = ~binaryImage;
M1 = function_verification_code(binaryImage);
% only plot if there's more than one point
if size(M1,1)>1
% Switch to the figure for the 3-D plotting:
figure(hFig3);
current_z = z(k) * ones(size(M1, 1), 1);
plot3(M1(:, 2), current_z, M1(:, 1), 'b.');
hold on
drawnow;
end
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!