Convert from textread() to textscan()

19 visualizaciones (últimos 30 días)
joeyapp
joeyapp el 16 de Feb. de 2013
I'm trying to update my code and was wondering if anyone can help with this simple question:
How would these two lines transfer over from textread() to textscan() in matlab?
[x,y,z]=textread(filename,'%f %f %f %*f %*f %*f','headerlines',3);
[X(:,k),Y(:,k),Z(:,k)]=textread(filenames,'%*f %*f %*f %f %f %f','headerlines',3);
  1 comentario
Jan
Jan el 17 de Feb. de 2013
Please send an enhancement request to TMW and ask for not removing textread. There is no advantage in removing working commands.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 17 de Feb. de 2013
Assuming the same file is being referenced for both:
fid = fopen(filename);
xyzcell = textscan(fid, '%f %f %f %f %f %f', 'HeaderLines', 3);
fclose(fid);
x = xyzcell{1};
y = xyzcell{2};
z = xyzcell{3};
X(:,k) = xyzcell{4};
Y(:,k) = xyzcell{5};
Z(:,k) = xyzcell{6};

Más respuestas (0)

Categorías

Más información sobre Data Import and Export 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