Help doing the average between successive (1,2) cells of two different arrays?
显示 更早的评论
Hi! I have a (250,2) array and i divide that array in two array: one contains the even rows and the other the odd rows. Those coordinates are points and i want to find the mid point of those two points(the odd one and the even one, between 1 and 2, then between 2 and 3, then between 3 and 4, and so on...) Is there a way to do this?
Thank you very much
采纳的回答
更多回答(1 个)
Azzi Abdelmalek
2014-3-30
编辑:Azzi Abdelmalek
2014-3-30
a=rand(250,2)
a1=a(1:2:end,:);
a2=a(2:2:end,:);
b=(a2+a1)/2
4 个评论
Jacob
2014-3-30
Azzi Abdelmalek
2014-3-30
编辑:Azzi Abdelmalek
2014-3-30
This is not clear, give a short numeric example, for example 8x2 array
Jacob
2014-3-30
编辑:Azzi Abdelmalek
2014-3-30
Azzi Abdelmalek
2014-3-30
编辑:Azzi Abdelmalek
2014-3-30
I think you need this
a =[ 4 3
2 2
3 3
4 2]
a1=a(1:end-1,:)
a2=a(2:end,:,:)
b=(a1+a2)/2
类别
在 帮助中心 和 File Exchange 中查找有关 Language Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!