How to prevent readtable excluding rows with "NA"?
Show older comments
I have a textfile in this format (also attached) produced from an image processing loop, which when read in using readtable(), gives me the resulting table.
% Image X Y Area Circularity Extent Height Width
% IMG_0560.jpg NA NA NA NA NA NA NA
% IMG_0561.jpg NA NA NA NA NA NA NA
% IMG_0562.jpg NA NA NA NA NA NA NA
% IMG_0565.jpg 2388.9432 1028.7865 740 1.0291 0.83053 2736 3648
% IMG_0566.jpg 3020.4438 1152.3859 1433 0.99398 0.7788 2736 3648
% IMG_0567.jpg NA NA NA NA NA NA NA
% IMG_0568.jpg 3512.2915 878.88912 1434 1.0338 0.83275 2736 3648
readtable("C:\Desktop\exampletxt.txt");
% Image X Y Area Circularity Extent Height Width
% ________________ ______ ______ ____ ___________ _______ ______ _____
%
% {'IMG_0565.jpg'} 2388.9 1028.8 740 1.0291 0.83053 2736 3648
% {'IMG_0566.jpg'} 3020.4 1152.4 1433 0.99398 0.7788 2736 3648
% {'IMG_0567.jpg'} NaN NaN NaN NaN NaN NaN NaN
% {'IMG_0568.jpg'} 3512.3 878.89 1434 1.0338 0.83275 2736 3648
As you can see it excludes the first few rows that contain NAs, which I need to be included, as it has done correctly for the third row. Is there a way to do this with readtable? Ultimately, all I need is the first column, as I'm then using contain() to see if a given image name exists in this textfile.
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots 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!