Borrar filtros
Borrar filtros

arrange columns side by side using matlab

1 visualización (últimos 30 días)
Seismic D
Seismic D el 3 de Jul. de 2021
Comentada: Seismic D el 3 de Jul. de 2021
Hii experts, i have 5000 .txt file in a directory that contains single column data. i want to arrange them side by side seqentially to make a mxn matrix file.
My files serial number starts from 1.txt 2.txt.....5000.txt
  2 comentarios
Scott MacKenzie
Scott MacKenzie el 3 de Jul. de 2021
Are the data numeric? Is the number of values the same in each file?
Seismic D
Seismic D el 3 de Jul. de 2021
yes data is numeric like 2.867075e+01,6.455939e+00....etc

Iniciar sesión para comentar.

Respuestas (1)

Scott MacKenzie
Scott MacKenzie el 3 de Jul. de 2021
Editada: Scott MacKenzie el 3 de Jul. de 2021
n = 5000; % number of files to read
basefilename = 'temp'; % change as necessary
M = []; % preallocate if you know the number of values in each file
for i=1:n
f = [basefilename num2str(i) '.txt'];
if isfile(f) % verify file exists (as a precaution)
M(:,i) = readmatrix(f);
end
end
  1 comentario
Seismic D
Seismic D el 3 de Jul. de 2021
No it doesnot do what i expect....please modify script if possible

Iniciar sesión para comentar.

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by