importdata cuts my files in half!

drct = 'S_up_';
top = importdata(strcat(drct,'200.txt'));
The attached .txt file is 5000 rows tall, but when I use importdata or load, it only loads the first 2500 rows.
There is no header, only straight data. I also tried specifying space delimiter but the problem persists.
So it exactly cuts my data in half, Weird.
version R2016a

1 Comment

Stephen23
Stephen23 on 11 Aug 2020
Edited: Stephen23 on 11 Aug 2020
"The attached .txt file is 5000 rows tall, but when I use importdata or load, it only loads the first 2500 rows."
The file actually has 2500 rows, this is the end of the file:

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 11 Aug 2020
Edited: Cris LaPierre on 11 Aug 2020
When I open the file you have attached (outside MATLAB), it only contains 2500 rows. Perhaps you meant to attach a different file? Or perhaps you are mistaken in thinking the file has 5000 rows?

1 Comment

Hi Chris, it turns out the problem was in the path setting, about 100 lines earlier in the code! I thought it was getting cut in half because of the last time value but it turns out it was just loading a completely different file.
Anyway, your comment helped me locate the problem. Thanks so much!

Sign in to comment.

Products

Release

R2016a

Asked:

on 11 Aug 2020

Edited:

on 11 Aug 2020

Community Treasure Hunt

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

Start Hunting!