MATLAB MATLAB Write result to txt file

  • Thread starter Thread starter NoobixCube
  • Start date Start date
  • Tags Tags
    File Matlab
Click For Summary
To write results from a MATLAB program to a text file, the 'save' command can be used for saving variables, while 'fprintf' is suitable for formatted output. For multiple outputs generated in a loop, it's recommended to concatenate the results into an array before saving. Users can refer to the MATLAB documentation for detailed instructions on using these commands. Searching for "MATLAB file io" can also provide additional guidance. Properly utilizing these commands will enable effective output management in MATLAB.
NoobixCube
Messages
154
Reaction score
0
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:
 
Physics news on Phys.org
If you want to save variables to a text file, try the save command.

For formatted output, try the fprintf command
 
Cheers siddharth I will have a gander.
 
you can search google by the keyword : MATLAB file io
then ,you will get the result you wanted
 
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
 
sivagami said:
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

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.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
Replies
6
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 20 ·
Replies
20
Views
4K