有时候需要将向量或矩阵转为行向量,方便输出或操作,可以不用判断,利用(????,所有元素“:”来自动获取拉平的值(注意matlab是按列优先取值)。免于判断烦恼。a = [1,2,3,4]a_row = a(:)'a2 = a'a2_row = a(:)'A1 = [1,2,3;4,5,6]A1_row = A1(:)'A1b = A1'A1_row = A1b(:)'resultsa = 1 2 3 4a_row = 1 2 3 4
Octave/Matlab
2023-05-16
42 点赞
0 评论
63 浏览