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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:44:56+00:00 2026-05-12T14:44:56+00:00

I am just beginning to learn Matlab , so this question might be very

  • 0

I am just beginning to learn Matlab, so this question might be very basic:

I have a variable

a=[2.3 3.422 -6.121 9 4.55]

I want the values to be output to a .txt file like this:

2.3
3.422
-6.121
9
4.55

How can I do this?

fid = fopen('c:\\coeffs.txt','w'); //this opens the file
//now how to print 'a' to the file??
  • 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-12T14:44:56+00:00Added an answer on May 12, 2026 at 2:44 pm

    The following should do the trick:

    fid = fopen('c:\\coeffs.txt','wt');  % Note the 'wt' for writing in text mode
    fprintf(fid,'%f\n',a);  % The format string is applied to each element of a
    fclose(fid);
    

    For more info, check out the documentation for FOPEN and FPRINTF.

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

Sidebar

Related Questions

I am just beginning to learn SQL and have stumbled at the first hurdle,
I am just beginning to learn command line scripts, and I have an assignment
I'm just beginning to have a look at Objective-C and Cocoa with a view
I'm just beginning to use Regex so bear with my terminology. I have a
just a quick question: I am a CS undergrad and have only had experience
I’m just beginning to learn Django and I like the automatic listing in Django
I'm just beginning to learn the concept of threading, and I'm kind of stuck
I am just beginning to learn how to write software that accesses an SQL
I'm just beginning to learn python and the program I'm writing requires parameters for
I'm just beginning to learn about the differences between how css (and html) is

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.