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