Filter löschen
Filter löschen

Split array values into 2 elements

3 Ansichten (letzte 30 Tage)
sp
sp am 5 Dez. 2012
A = [126126,138154,137146]
Output i want is A = [126,126,138,154,137,146]
  2 Kommentare
José-Luis
José-Luis am 5 Dez. 2012
Praveen, please accept answers if they help you. I have looked at your question history and you never seem to do that.
sp
sp am 5 Dez. 2012
Bearbeitet: sp am 5 Dez. 2012
hey i do accept...whn i find right answers... thank you

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

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

Weitere Antworten (2)

Azzi Abdelmalek
Azzi Abdelmalek am 5 Dez. 2012
Bearbeitet: Azzi Abdelmalek am 5 Dez. 2012
out=str2num(reshape(num2str(A')',3,[])')'

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

Kategorien

Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by