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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:09:01+00:00 2026-05-28T01:09:01+00:00

I have a file that has numerous data points, all formatted like XX.XXX The

  • 0

I have a file that has numerous data points, all formatted like XX.XXX The numbers are strung together continuously.

How do I separate all the numbers into individual values?

I tried reading from the file with ‘%5.3d’ and ‘%5.3f’ but neither of them worked. Likewise, ‘%6s’ did not work.

Example Input:

75.91425.43937.55492.55874.43839.51519.59935.11762.33178.14914.81569.43037.90083.32590.492
70.45060.24634.07148.20638.34348.88881.90070.37655.06531.76382.54791.43659.88274.56288.827
87.28590.39641.39551.67340.39870.613

Desired Output:

75.914
25.439
37.554
92.558
etc.

I have tried:

fscanf(Fid,'%6.3f',[3 inf]);
fscanf(Fid,'%5.3f',[3 inf]);
fscanf(Fid,'%5.3f',[3 inf]);
fscanf(Fid,['%2d' char('.') '%3d'], [6 inf]);
  • 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-28T01:09:02+00:00Added an answer on May 28, 2026 at 1:09 am

    Assuming every element is 6 characters you could do the following since fscanf isn’t working. Note: I saved your sample into “numData.txt”

    EDIT: This is much better.

    fid = fopen('numData.txt','r');
    numArray = textscan(fid,'%6.3f',inf);
    

    gives

    numArray =
    
       75.9140
       25.4390
       37.5540
       ... etc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a test file that has many lines, each line looks something like:
I have a html file that has invoice details I would like to know
I have an image file that has all the character sprites that I will
I have an xml file that has an address node that looks like <address>
I have a text file that has item numbers in it (one per line).
I have a file that has a single column of numbers. I have to
I have a file that has different lines of texts, I would like to
I have a file that has the following format: 12345 TAB_HERE Name : The
I have an XML file that has a number of nodes, each of which
I have a huge file that has some lines that need to have a

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.