Why is Matlab not importing my entire file when using importdata?

I tried to import a gcode file into Matlab using importdata. However, only the first 60 lines (over 400+) were imported. I deleted the empty lines in my gcode file and more lines were imported into Matlab. However, i can't get all my data imported.

2 Comments

Did you try using the Import Data gui (on the command window)? When you do it from there, it will visually show the range of values that will be imported. You might be able to glean why it is stopping at that row.

Sign in to comment.

 Accepted Answer

The fact that you had empty lines in your file tells us that your file is not a simple file in which there is (possibly) a header line, after which each line is a numeric array that is the same length on every line. importdata() can figure out some things about headers, but once it is into the part that it figures is numeric data, then any change in the numeric format will typically cause importdata() to stop importing the data.

3 Comments

Thank you for this explanation. My file is starting with gcode comments, once removed, i was able to fully import my data.
I have a similar situation with importdata. I have a header line then several rows of data below it. ThenIi have another header line/row with the mean values below it. What would sugesst I use since importdata won't work?
R
Rebecca, should only the "several rows of data" be read in, or should some of the information from after the first block be read in as well ?

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!