Using importdata function without importing the first line of text file

I am trying to import the data from different text files, but I don't want to import the first line of those files. My text files contain data like this.
So, I use the IMPORTDATA function to import all contents except the first line.
filename{k} = importdata (name{k}, ' ', 1);
While the name variable is a cell array that keeps the names of my files and filename is used to keep those contents. As my understanding, this function should return all content in the file except the first line and keep in the filename variable. However, when I printed out the value of filename, I got only the first line not the other content that I want. What I got is shown below.
So, is there anything I have missed? Please help!

 채택된 답변

Guillaume
Guillaume 2018년 7월 4일

0 개 추천

is there anything I have missed?
Yes, the data field of your filename structure, which as indicated in your screenshot contains a 4x3 double array which is the 4 remaining lines of your file.
As an aside, filename is a very misleading name for what that variable holds. filecontent would be a lot more accurate.

댓글 수: 1

Oh! Thank you for your answer and suggestion, it is very helpful for me. I had really missed it. Lol.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by