How can I delete empty cells in a table so that their data is merged into the same line?

4 views (last 30 days)
I've got a file that was formatted oddly, so that sometimes entries are separated by newlines, and sometimes they are separated by spaces. When I imported the data from a text file, it turned out as it appears in the attached picture. I'm trying to figure out a way to loop through and change the newline characters into spaces so I can use the same delimiter for the whole file. Does anyone have any advice on how to go about this?
Thanks for your help.

Answers (1)

Image Analyst
Image Analyst on 16 Dec 2018
Try this:
t = readtable(fileName)
tNew = rmmissing(t)
If that doesn't work, then attach your data and the code you used to create your table.

Categories

Find more on Text Data Preparation 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!