Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB Write result to txt file

  1. Jun 27, 2008 #1
    Hey All,
    Quick question hope someone can help.
    Does anyone know how to write the result from a program in MATLAB to a text file ?
    I have googled this question to no avail.
    :confused:
     
  2. jcsd
  3. Jun 27, 2008 #2

    siddharth

    User Avatar
    Homework Helper
    Gold Member

    If you want to save variables to a text file, try the save command.

    For formatted output, try the fprintf command
     
  4. Jun 27, 2008 #3
    Cheers siddharth I will have a gander.
     
  5. Jul 1, 2008 #4

    zyh

    User Avatar

    you can search google by the keyword : matlab file io
    then ,you will get the result you wanted
     
  6. Feb 3, 2010 #5
    i want to save my output in text file. i use for loop so it produce n outputs.i want to save all the output in my single file
     
  7. Feb 4, 2010 #6

    MATLABdude

    User Avatar
    Science Advisor

    Welcome to PhysicsForums!

    If your outputs are numbers, concatenate your numbers together into an array and then save using the save command (type 'help save' to figure out how to get ASCII output). Otherwise, you'll need to use fprintf.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: MATLAB Write result to txt file
  1. Matlab writing to file (Replies: 1)

Loading...