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

  • Home
  • SEARCH
  • 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 217803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:41:29+00:00 2026-05-11T18:41:29+00:00

I want to save a matrix to a text file, so I can read

  • 0

I want to save a matrix to a text file, so I can read it by another program. Right now I use:

save('output.txt', 'A','-ascii');

But this saves my file as

6.7206983e+000  2.5896414e-001
6.5710723e+000  4.9800797e-00
6.3466334e+000  6.9721116e-001
5.9975062e+000  1.3346614e+000
6.0224439e+000  1.8127490e+000
6.3466334e+000  2.0517928e+000
6.3965087e+000  1.9721116e+000

But I would like to have them saved without the “e-notation” and not with all the digits. Is there an easy way to do this?

Edit: Thank you! That works just fine. Sorry, but I think I messed up your edit by using the rollback.

  • 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-11T18:41:30+00:00Added an answer on May 11, 2026 at 6:41 pm

    I would use the fprintf function, which will allow you to define for yourself what format to output the data in. For example:

    fid = fopen('output.txt', 'wt');
    fprintf(fid,'%0.6f %0.6f\n', A.');
    fclose(fid);
    

    This will output the matrix A with 6 digits of precision after the decimal point. Note that you also have to use the functions fopen and fclose.

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

Sidebar

Related Questions

I want to save my program's DataModel objects to a file, and be able
I am using sink() function for printing R output to excel/text file. my program
I want to save a matrix into a file, therefore I'm using dlmwrite('matrix', m);
I want to save two sparse matrix Y and R to a mat file.
I want to save values as an ArrayList of double in a file. Whenever
I want to save a remote img-file to my server, but I don't know
I want to save a string with its corresponding index in a matrix but
I want to save an NSMutableArray or NSDictionary as a permanent file. Then, I
i want to save data in two table mysql, that was nice, but now
I created a bitmap and now i want to save that bitmap to 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.