How can I get the text instead of NaN when using import options for readtable?
1 view (last 30 days)
Show older comments
Dear all,
I'm using readtable to import data from an open inventor file. The file has some delimited text and point cloud data as x,y,z coordinates that I need.
The file for example looks like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/429673/image.png)
My code so far only separates all coordinates from the open inventor file.
To separate them I use readtable with following import options:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/429678/image.png)
But now I want to:
- Import the open inventor file as a table (like I do already)
- Find a range that can be defined by a first/last row with a specified text
- Remove all NaN rows in this range to separate the coordinates
- Use finally a n-rows by 3-columns table to continue processing
My problem now:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/429683/image.png)
If I convert the file to a table with the import options from above, I cannot search for the range boundaries I need, because every text element is converted to NaN. How can I get back the original text and search for the specified rows including text?
attached is a text file that is identical to the open inventor file. If you try to reproduce my code, please rename the extention to ".iv" to reproduce the same behaviour.
I'm using Matlab 2020b.
Thank you very much in advance!
3 Comments
dpb
on 16 Dec 2020
I suspect you'd be surprised at relative timing between fgetl and calling detectImportOptions, readtable and table2array twice
Answers (1)
See Also
Categories
Find more on Logical 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!