I import data from some .asc files into Mathematica using the Import[filename, "Data"] command and save it in a table. I ran into a problem when sometimes there are several empty lines at the end of the file in the .asc files, which leads to empty values โโin the table, which subsequently lead to some problems.
For example, when I look at data[[5 ;; (Length[data])]] data[[5 ;; (Length[data])]] , I get:
{{3446.05, 15.5156}, {3446.18, 14.5156}, ..., {3451.49, 7.51563}, {}, {}, {}, {}}
So my question is: what is the best way to get rid of these empty values? I looked at either ignoring the spaces in the Import, but did not find anything that could do this. I also looked at Delete , but I cannot get an expression that matches empty values.
One way to do this is to change the Length[data] to 'Length [data] -4`. However, this should potentially be changed for each file, and I would prefer something more generalized solution that will work for any file, regardless of whether they have a space or not.
Matts source share