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 6823337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:46:15+00:00 2026-05-26T21:46:15+00:00

I have a text file that looks like so: A B C 1 2

  • 0

I have a text file that looks like so:

A    B    C
1    2    3

(This is just a minimal example of what I actually have. My actual files are HUGE and vary in number of rows.)

I would like to load in this file into Octave. However, the file contains letters, rather than just numbers. When I’m trying to apply the load function, I get errors, and I guess this is because the load function only accepts numbers. What function should I use instead?

  • 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-05-26T21:46:16+00:00Added an answer on May 26, 2026 at 9:46 pm

    Call fopen, fscanf, and fclose. The format string must be different for lines containing only letters (like '%s\t%s\t%s'), and for those which contain only numbers (like '%g\t%g\t%g'). You can read lines of identical structure with a single fprintf call.

    Example file (data.txt):

    A        B        C
    D        E        F
    1        2        3
    4        5        6
    7        8        9
    10       11       12
    

    Suppose that we know in advance that the file contains 3 columns, and 2 lines with characters at the beginning:

    fid = fopen('data.txt', 'r');
    [x, nx] = fscanf(fid, '%s\t%s\t%s', [3, 2]);
    [y, ny] = fscanf(fid, '%g\t%g\t%g', [3, Inf]);
    fclose(fid);
    

    The lines with the characters will be in x', and the lines with numbers will be contained by y'.

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

Sidebar

Related Questions

I have a text file that looks like this: value1 value2 value3 There are
I have a huge file that looks like this: 7 bla1 blala blabla blab
I have a text file that currently looks like this: <joke>What do you call
Let's just say I have an XML file that looks like this: <?xml version=1.0
I have an xml file that looks something like this <questions> <question> <text>What color
In my aspx file, I have some code that looks like this: <script type=text/javascript>
I have a text file that looks a bit like: random text random text,
I have a text file that I want to send over the network, this
We have some html that looks like this: <form id=MyUserControl runat=server method=post> <script language=javascript
I have a controller that looks like this for importing xml to my site:

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.