MATLAB: How to add “…” to multiple lines

input

Hi,
I think I have a simple question. I pasted a large number of 3D points into an mfile. There are N >10000 points and each is on a separate line i.e.
1 2 3
4 5 6
7 8 9
...
I want to assign the whole mess to one 3Nx1 vector. Is there an easier way to do this than putting [] around it and … at the end of each line? That is, is there a way to tell Matlab to ignore line breaks for a section (and say replace them with tabs)? Or another creative solution?
Thanks. It seems a little silly, but I'd love to avoid spending my afternoon pasting "…"s…
-greg

Best Answer

There is a better way. I assume you pasted the data so the data has multiple lines. You only need to add one "[" at the beginning of the first line and add one "]" at the end of the last line to make it a matrix. Then you can reshape it to a vector.
a=[1 2 3
4 5 6
7 8 9];
b=a';
b=b(:)