How to add "..." to multiple lines
조회 수: 4 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Fangjun Jiang
2011년 11월 4일
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(:)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!