Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8387589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:15:15+00:00 2026-06-09T18:15:15+00:00

I am trying to use the load() function in MATLAB to read in data

  • 0

I am trying to use the load() function in MATLAB to read in data from a text file. However, every line of the text file ends with ‘…’. The data file is not produced by MATLAB, so I have no control over the source of the ellipses.

The data file I’m loading in looks something like this:

11191425        NaN     NaN     0.0 ...
11191426        NaN     NaN     0.0 ...
11191427        NaN     NaN     0.0 ...
11191428        NaN     NaN     0.0 ...
11191429     2280.5  1910.1   455.0 ...
11191430     2280.5  1910.1   455.0 ...
11191431     2298.0  1891.1   454.0 ...
11191432     2317.3  1853.7   453.0 ...
11191433     2335.6  1811.1   458.0 ...
11191434     2350.6  1769.8   466.0 ...
11191435     2365.3  1729.7   475.0 ...
11191436     2379.5  1691.2   485.0 ...
11191437     2378.3  1647.6   492.0 ...
11191438     2375.4  1621.3   499.0 ...
11191439     2372.7  1598.5   499.0 ...
11191440     2372.7  1598.5   499.0 ...
11191441        NaN     NaN     0.0 ...
11191442      294.9  1283.5  1163.0 ...
11191443      294.9  1283.5  1163.0 ...

Its actual length is in excess of 100,000 rows, but you get the idea. Using the load() command throws an error because of the ‘…’s at the end of each line. All I’m looking for is to read in those first four columns.

What would be the most efficient way of loading the data in, whilst completely omitting the rogue column of ellipses at the end? A method that doesn’t involve making the system parse the whole text file twice would be preferable, though not necessary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:15:16+00:00Added an answer on June 9, 2026 at 6:15 pm

    This is pretty easy if instead of using load, you use textscan. You can treat that last column as a string column and then just ignore it.

    fid = fopen('data.txt');
    data = textscan(fid,'%d %f %f %f %s');
    fclose(fid);
    

    You could then make the output a single matrix by concatenating the columns you want to keep together.

    data = [data{1:4}];
    

    The fifth column is just filled with ‘…’ strings. You can just ignore it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use simplexml to load an xml file from a server: $xml
I am trying to use jquery ajax to get data from a php file.
I'm trying to use the .each() function of JQuery on a body load to
I'm trying to use the following code # LOAD XML FILE $XML = new
I'm trying to use full calendar to load events from a json source. The
I'm trying to use a simple HTTP get to load a string from a
I'am trying to use some values from the upper function in the inner function:
I'm trying to use jquery load function, but I can't get the whole content
I'm having a little problem. I'm trying to use Jquery load() function to load
I am trying to use jQuery's .load function to dynamically load content into my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.