how to convert matrix A 1 x 200 into 100 x2
3 次查看(过去 30 天)
显示 更早的评论
I have a matrix A=( x1 y1 x2 y2....)
Now I want all the value of x in one column and y in one column.
I had been tried
for i= 1: N
x= A(1,2*i-1);
y= A(1,2*i);
end
Please helps. Thanks
0 个评论
采纳的回答
Azzi Abdelmalek
2013-6-10
编辑:Azzi Abdelmalek
2013-6-10
Edit
A=[1 2 3 4 5 6]
out=reshape(A,2,[])'
%or
out=[A(1:2:end)' A(2:2:end)']
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!