필터 지우기
필터 지우기

importdata import only first part

조회 수: 8 (최근 30일)
Eliah Verbeemen
Eliah Verbeemen 2018년 5월 16일
댓글: dpb 2018년 5월 16일
I would like to use importdata to import my textfile. I have 20 headerlines and the file is tab delimited. But when I use this code:
delimiterIn ='\t' ;
column = 20;
array{U} = importdata(FileName,delimiterIn, column);
I only get a cell array.
What did I do wrong?
  댓글 수: 7
Eliah Verbeemen
Eliah Verbeemen 2018년 5월 16일
편집: dpb 2018년 5월 16일
for the loop:
while k=1
importdata
U=U+1
questiondilogbox do you want to import another file?
Yes
No k=0
For the loop name
Yes the name is strange but I use headerliens multiple times en colum refer to an earlier determined value.
dpb
dpb 2018년 5월 16일
Don't take "shortcuts"; cut 'n paste *precisely and identically the code itself"; yest details DO matter.
In general it will be well rewarded over the long haul if you impose discipline when writing code such that variable names do tend to have meanings related to their purpose; trying to reuse names for multiple purposes or to not create another variable name for a purpose is false economy; the confusion raised far out weighs what miniscule amount of memory might be saved.
As for the question of the cell array, if you're going to be importing multiple files such as this, unless you can ensure that every file has the identical number of variables/size, then storing those as arrays in a cell array is one of the fairly limited number of choices you have; a 3D array with each file being a plane of 2D can only exist if each is identical in size; you could concatenate the same number of variables but wouldn't then know which part of the final result came from which file (which may or may not be important)
All in all, without example data files and just what you're needing to do in the end, it's all just a guessing game.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by