?? matrix2str.m
字號:
function outstr = matrix2str(matrix0)
%
% This function converts a matrix into a string
% Its dual function : evalin('base', str)
%
%
outstr='[';
[nrows,ncols]=size(matrix0);
for N=1:nrows,
outstr=[outstr, term2str(matrix0(N,1)) ];
for P=2:ncols,
outstr=[outstr, ', ', term2str(matrix0(N,P)) ];
end
if N<nrows, outstr=[outstr, '; ']; end
end
outstr=strcat(outstr, ']');
if nrows<=1 & ncols<=1
outstr=term2str(matrix0);
end
% in case the element of the matrix is symbolic expression
function outstr = term2str(term)
if isnumeric(term)
outstr=num2str(term,'%0.6g');
else
outstr=char(term);
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -