Simple formatted ASCII output

版本 1.0.0.0 (2.6 KB) 作者: Miroslav Balda
Easy formatted output of ASCII data
2.5K 次下载
更新时间 2006/2/13

查看许可证

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');

引用格式

Miroslav Balda (2024). Simple formatted ASCII output (https://www.mathworks.com/matlabcentral/fileexchange/9954-simple-formatted-ascii-output), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R14
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Use COM Objects in MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0