vec2str.m
来自「ipr函数库与仿真实验程序,都是要用到的库函数。」· M 代码 · 共 29 行
M
29 行
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 + =
减小字号Ctrl + -
显示快捷键?