Azzera filtri
Azzera filtri

importdata import only first part

8 visualizzazioni (ultimi 30 giorni)
Eliah Verbeemen
Eliah Verbeemen il 16 Mag 2018
Commentato: dpb il 16 Mag 2018
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 Commenti
Eliah Verbeemen
Eliah Verbeemen il 16 Mag 2018
Modificato: dpb il 16 Mag 2018
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 il 16 Mag 2018
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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Large Files and Big Data in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by