How do I concatenate cells in each row in a matrix?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear Matlab users,
I need to cancat each row's cell in a matrix, For example: I have this matrix:
8 1 6
3 5 7
4 9 2
My goal is to have this form: 816, 357, 492.
I am beginner with matlab. I would be very grateful if you could help me. Thanks in advance.
1 Kommentar
Stephen23
am 15 Jul. 2016
Bearbeitet: Stephen23
am 15 Jul. 2016
"My goal is to have this form: 816, 357, 492."
Can you please explain what you want: is this three numbers with values 816, 357, and 492, or three separate vector of integers {[8,1,6],[3,5,7],[4,9,2]}, or is this three strings {'816','357','492'}, or something else entirely?
Your description is not very clear what you want the output to be.
Akzeptierte Antwort
AMAL targhi
am 15 Jul. 2016
Bearbeitet: Guillaume
am 15 Jul. 2016
a = [ 8 1 6 ; 1 2 3 ; 4 5 6 ]
[l c ] = size (a) ;
b = cell (l,1);
for i =1 : l
b {i,: } = [ a(i,1) a(i,2) a(i,3) ] ;
end
7 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Octave finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!