Borrar filtros
Borrar filtros

How can i read second column from a txt file in matlab

10 visualizaciones (últimos 30 días)
arooba mazhar
arooba mazhar el 12 de Mzo. de 2017
Editada: Walter Roberson el 12 de Mzo. de 2017

Respuesta aceptada

Abdurrehman
Abdurrehman el 12 de Mzo. de 2017
Editada: Abdurrehman el 12 de Mzo. de 2017
[Filename,FilePath]=uigetfile('\\Address\*.txt','Load File');
FileName=fullfile(FilePath,Filename);
NoofCol=7;% Total no of col. in ur file
Format=repmat('%s',1,NoofCol);
fid=fopen(FileName,'rt');
Header=fgetl(fid);% to delete first line (You can use this line as title for data plotting)
data_cell=textscan(fid,Format,'HeaderLines',1,'CollectOutput',1);
fclose(fid);
data=data_cell{1};
SecCol=str2double(data(:,2));
Hope the above will help you
  3 comentarios
arooba mazhar
arooba mazhar el 12 de Mzo. de 2017
Thanks alot it worked :)
Abdurrehman
Abdurrehman el 12 de Mzo. de 2017
It was my very first answer :-)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by