转换矩阵的一列

1.335视图(30天)
盖太诺Sciacovelli
盖太诺Sciacovelli 2012年4月18日
编辑: 图像分析 2022年7月14日
你好,我已经把一个矩阵列向量组成的原始矩阵的所有列。我怎么能这样做呢?谢谢
5个评论
图像分析
图像分析 2020年4月9日
你说“我要把一个矩阵列向量组成的所有原始矩阵的列”。I thought you meant you had a column vector and had to convert it to a matrix having the same number of columns as the original matrix from where the column vector came. In other words, I thought you meant "I have to convert a matrix of one column vector 成一个 所有原始矩阵的列组成的。”
看到你接受的答案,看来,你真正的意思是“我要把一个矩阵 一个列向量,由所有原始矩阵的列”。Leaving out seemingly minor words completely changes the interpretation of the question, as does their placement in the sentence.

登录置评。

接受的答案

安德烈Bobrov
安德烈Bobrov 2012年4月18日
yourvector = yourmatrix (:);
10评论
图像分析
图像分析 2022年7月14日
编辑:图像分析 2022年7月14日
@rishika yadav 您可以使用 interp2 插入不同的高度:
m =重塑(1:18,[],3)% 6行3列创建示例数据
(oldHeight、列)=尺寸(米)
%由插值矩阵高。
newHeight = 8;
[xq, yq] = meshgrid(1:列,linspace (1 oldHeight newHeight));
mTaller = interp2 (m, xq, yq)
流(mTaller的大小是由% d % d行列。\ n \ n”、大小(mTaller, 1),大小(mTaller, 2))
%由插值矩阵高。
newHeight = 3;
[xq, yq] = meshgrid(1:列,linspace (1 oldHeight newHeight));
mShorter = interp2 (m, xq, yq)
流(mShorter的大小是由% d % d行列。\ n”、大小(mShorter, 1),大小(mShorter, 2))
第一行/上和上/下将有相同的价值观,和更多,或更少,行插值在顶部和底部行,这样你有新的期望的高度。

登录置评。

更多的答案(4)

库里尔•考夫曼
库里尔•考夫曼 2020年4月26日
更多的算法解决方案:
%从向量矩阵
N = 10;
mat1 =兰德(N);
vec1 = 0 (N * N, 1);
i = 1: N
j = 1: N
vec1((张)* N + j) = mat1 (i, j);
结束
结束
%从向量矩阵
N = 10;
vec2 =兰德(N * N, 1);
mat2 = 0 (N);
i = 1: N
j = 1: N
mat2 (i, j) = vec2((张)* N + j);
结束
结束

图像分析
图像分析 2012年4月18日
如果你的列向量是“由原始矩阵的列”,然后使用重塑()命令把它从一个列向量回原来的二维矩阵。
matrix2D =重塑(columnVector列(行);
(反过来,如何让列向量在第一时间(你可能已经做了什么让你的向量)完成这样columnVector = fullMatrix (:))。
7评论
詹姆斯Tursa
詹姆斯Tursa 2019年10月25日
请发布一个新问题的细节问题。

登录置评。


里侯赛因
里侯赛因 2016年12月15日
columnvector =矩阵(:)这个工作好

阿米尔KHFAGI
阿米尔KHFAGI 2020年3月23日
你好,我已经将一个列向量在matlab矩阵。我怎么能这样做呢?

类别

找到更多的在调整和重塑矩阵帮助中心文件交换

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!

翻译的