importdata import only first part
조회 수: 8 (최근 30일)
이전 댓글 표시
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
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 Center 및 File 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!