5.0

5.0 | 1 rating Rate this file 1 Download (last 30 days) File Size: 2.58 KB File ID: #9954

Simple formatted ASCII output

by Miroslav Balda

 

11 Feb 2006 (Updated 13 Feb 2006)

Easy formatted output of ASCII data

| Watch this File

File Information
Description

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.

Examples:

% display a matrix in the '%15.6e' format:
 out(rand(2,3));
% 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:
 out('','%s\n',h);
% append Z in the '%8.4f' format
 out(Z,'%8.4f',h);
% close the file 'cmplxZ.dat':
 out;
% 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:
 out(1:5,'%4i\n');
% display a line of 50 characters '=':
 out(char('='*ones(1,50)),'%s\n');

MATLAB release MATLAB 7 (R14)
Other requirements Needs the function inp.m from the File Exchange
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
03 Jun 2009 Joseph

great

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data import Miroslav Balda 22 Oct 2008 08:15:27
data export Miroslav Balda 22 Oct 2008 08:15:27
ascii Miroslav Balda 22 Oct 2008 08:15:27
screen Miroslav Balda 22 Oct 2008 08:15:27
files Miroslav Balda 22 Oct 2008 08:15:27
format Miroslav Balda 22 Oct 2008 08:15:27

Contact us at files@mathworks.com