Split array values into 2 elements

3 次查看(过去 30 天)
A = [126126,138154,137146]
Output i want is A = [126,126,138,154,137,146]
  2 个评论
José-Luis
José-Luis 2012-12-5
Praveen, please accept answers if they help you. I have looked at your question history and you never seem to do that.
sp
sp 2012-12-5
编辑:sp 2012-12-5
hey i do accept...whn i find right answers... thank you

请先登录,再进行评论。

采纳的回答

Jos (10584)
Jos (10584) 2012-12-5
编辑:Jos (10584) 2012-12-5
help rem
help floor
A = [126126, 138154,137146]
B = [floor(A/1000) ; rem(A,1000)]
B = B(:).' % for cosmetic purposes only

更多回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2012-12-5
编辑:Azzi Abdelmalek 2012-12-5
out=str2num(reshape(num2str(A')',3,[])')'

Steve
Steve 2012-12-5
The function you want is reshape:
A = reshape(A, 1, [])
This gives you the output you want (A = [126,126,138,154,137,146])

类别

Help CenterFile Exchange 中查找有关 Sparse Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by