Borrar filtros
Borrar filtros

Read Data From txt file using uigetfile...

9 visualizaciones (últimos 30 días)
Masoud Ghanbari
Masoud Ghanbari el 21 de Jun. de 2013
Hi
I Have to read a file using uigetfile by this code by i face the error...
[filename,pathname,d] = uigetfile('*.txt;');
filepath=fullfile('pathname','filename');
fid = fopen('filepath');
mline1 = textscan(fid, '%f%s%s%f%f%s%s%f%f ','HeaderLines',5);
fclose(fid);
Error:
Error using textscan
Invalid file identifier. Use fopen to generate a valid
file identifier.
By The Way I Already have done it without using uigetfile...
another point is data should be a number not a string cause they are going to plotted... What should i do to convert them???
  1 comentario
Walter Roberson
Walter Roberson el 21 de Jun. de 2013
For the bit about it needing to be a number, we need a sample input line.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 21 de Jun. de 2013
do not put the aote matks around filepath.
fopen(filepath)
  9 comentarios
Walter Roberson
Walter Roberson el 22 de Jun. de 2013
mline_num = [mline1{[1:5 7]}];
mline_txt = mline1{6};
Masoud Ghanbari
Masoud Ghanbari el 23 de Jun. de 2013
Thanks Dear Walter And Dear Azzi...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Large Files and Big Data 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