Importing text file containing numbers and words

조회 수: 2 (최근 30일)
Kamia Kavi
Kamia Kavi 2022년 12월 28일
답변: Jan Studnicka 2022년 12월 28일
I want to import a text file into MATLAB. I want MATLAB to ignore the first 3 lines, detect the 4th line as header, and identify data from the 6th row on. How can it be done?
filename
date
var1 var2 var3
abc1 100 abc1
abc2 200 abc2
  댓글 수: 2
Stephen23
Stephen23 2022년 12월 28일
"How can it be done?"
Of course: simply specify the appropriate options with READTABLE().
If you have any further questions, make sure that you upload a sample data file by clicking the paperclip button.
dpb
dpb 2022년 12월 28일
See @doc:readtable with optional named parameters and detectImportOptions

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

채택된 답변

Jan Studnicka
Jan Studnicka 2022년 12월 28일
data = readtable('soubor.txt','NumHeaderLines',3,'ReadVariableNames',true)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by