Simple formatted ASCII output

Easy formatted output of ASCII data
Updated 13 Feb 2006

View License

Function out.m sends ASCII data onto a screen or into a file in required or default formats. Data may be strings, and integer, real or complex numbers and matrices. The format is remembered for following outputs. The function extends possibilities yielded by the function disp and simplifies applications of fprintf.


% display a matrix in the '%15.6e' format:
% create a complex matrix Z:
Z = rand(3,2)+i*rand(3,2);
% write Z in the '%15.6e' format to the file:
h = out(Z,'','cmplxZ.dat');
% append new line into the file:
% append Z in the '%8.4f' format
% close the file 'cmplxZ.dat':
% make the new line character:
lf = char(10);
% display a string ending with new line:
out(['This is a string' lf]);
% display a column of integers:
% display a line of 50 characters '=':

Cite As

Miroslav Balda (2024). Simple formatted ASCII output (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Use COM Objects in MATLAB in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes