import multi type data in MATLAB

1 visualizzazione (ultimi 30 giorni)
SARAH ZAVAREH
SARAH ZAVAREH il 29 Giu 2011
How I can import a text file in MATLAB including 256 columns: first column is string and other columns are numeric data.

Risposta accettata

Gerd
Gerd il 29 Giu 2011
Hi Sarah,
depending on your specific file you can use
fid= fopen('File.txt');
textscan(fid,'%s%f.....');
fclose(fid);
Gerd
  6 Commenti
Jan
Jan il 29 Giu 2011
Data = textscan(fid,['%s' repmat('%f',1,255)]);
Then Data is a cell, which contains the different columns as elements. See "help textscan".
SARAH ZAVAREH
SARAH ZAVAREH il 29 Giu 2011
Thank you all, it works :)

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by