📄 vec2str.m
字号:
function s = vec2str(v)% Converts a vector (column or row) to a string that% prints on one line, with square brackets at both ends.% If v is a column vector, the elements are separated by ';'.%Input: v - vector to be converted%Output: s - string representation of v %%%%%%%%%%%%%%%%%%% vec2str.m %%%%%%%%%%%%%%%%%%%% Discrete-Time Control Problems using %% MATLAB and the Control System Toolbox %% by J.H. Chow, D.K. Frederick, & N.W. Chbat %% Brooks/Cole Publishing Company %% September 2002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[nrows,ncols] = size(v);if nrows > ncols, sep_str = '; '; else sep_str = ' ';ends = '[';for i = 1:length(v), s = [s num2str(v(i))]; if i < length(v), s = [s sep_str]; endends = [s ']'];%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -