savefile

function savefile saves workspace variable FILE as a formatted matrix FILENAME to disk.
1.4K Downloads
Updated 20 Oct 2005

No License

function savefile(file,path,format,index)

function savefile saves workspace variable FILE as a formatted matrix FILENAME to disk.

Input:
FILE workspace variable
PATH path and filename of saved FILE (output)

FORMAT Field Width and Precision Specifications of output

INDEX Conversion characters
Conversion characters specify the notation of the output.
SpecifierDescription:
c Single character%dDecimal notation (signed)
e Exponential notation (using a lowercase e as in 3.1415e+00)
E Exponential notation (using an uppercase E as in 3.1415E+00)
f Fixed-point notation
g The more compact of e or f , as defined in [2]. Insignificant zeros do not print.
G Same as %g, but using an uppercase E
i Decimal notation (signed)
o Octal notation (unsigned)
s String of characters
u Decimal notation (unsigned)
x Hexadecimal notation (using lowercase letters a-f)
X Hexadecimal notation (using uppercase letters A-F)

example
file1=rand(3,5);
savefile (file1,'d:\output.txt',5.2,'f')

Cite As

Sahar Sodoudi (2026). savefile (https://www.mathworks.com/matlabcentral/fileexchange/8764-savefile), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R13SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Low-Level File I/O in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0