Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
how to import a file from xls
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello, I am having difficulties to import a file from xls. I provide you with a part of mw data as follows:
262 268,5035949 272,5741509
262 264,3953307 271,695265
276 275,7568674 282,2664962
265 265,689301 266,2047494
261 262,3786524 262,7157746
263 264,2770077 263,9411982
264 269,5544951 265,8121476
270 268,95849 266,3144101
265 265,1169026 263,5498798
274 264,7772694 269,8253276
The data is like 3 columns but when I import it, it makes it 5 columns. Basically, I converted the xls files to txt file but still the same problem. Can someone comment on how to solve this problem?
Thanks
댓글 수: 0
답변 (1개)
Star Strider
2015년 8월 30일
One way of creating three columns from the five columns you imported:
data = randi(99, 10, 5); % Create Data
dstr = sprintf('%d\t%.0f.%.0f\t%.0f.%.0f\n', data'); % Create String From It
[D(:,1),D(:,2),D(:,3)] = strread(dstr); % Read As Numeric
The ‘D’ matrix is the output.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!