MAT2STR2

版本 1.0.0.0 (505 字节) 作者: Daniel Claxton
Converts matrix to formatted string.
2.0K 次下载
更新时间 2005/3/17

无许可证

MAT2STR2 Convert a 2-D matrix to eval'able string.

STR = MAT2STR2(MAT) converts the matrix MAT to a MATLAB string

STR = MAT2STR2(MAT,FORMAT) uses the format string used in C to format the matrix entries

Example:
MAT2STR2(rand(4),'%1.2f')

Returns:
0.18 0.54 0.47 0.73
0.98 0.67 0.68 0.88
0.51 0.47 0.24 0.57
0.76 0.35 0.45 0.52

MAT2STR2 also works for 3-D arrays

See also MAT2STR, NUM2STR, INT2STR, SPRINTF.

引用格式

Daniel Claxton (2024). MAT2STR2 (https://www.mathworks.com/matlabcentral/fileexchange/7152-mat2str2), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R13
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!

版本 已发布 发行说明
1.0.0.0

Small error in code (Line 37)
old:
out = [out; sprintf([d '\n'],A(:,:,i))];

new
out = [out; sprintf([d '\n'],A(:,:,i)')];