convert multiple .txt into .mat in same folder

4 visualizaciones (últimos 30 días)
cloudy snow
cloudy snow el 23 de Ag. de 2018
Comentada: Rik el 24 de Mzo. de 2019
I want to automatically convert multiple .txt files in a folder into .mat file in same folder . How can i do it programmatically?
  2 comentarios
Rik
Rik el 23 de Ag. de 2018
That depends on the contents of your txt files. What kind of variable should the file be loaded to? Once you have a script that converts the file to variables, it should be almost trivial to put that in a loop and run that for each file.
cloudy snow
cloudy snow el 25 de Ag. de 2018
Thank you for your suggestion..I can solve it now.

Iniciar sesión para comentar.

Respuesta aceptada

Pierre845
Pierre845 el 24 de Ag. de 2018
You need to load the text files first, by making a loop on the file names and using textscan (or dlmread) in the loop to load each file; then you concatenate the results in one single matrix, and to finish you use the 'save' function which will give you the .mat file you're after
  3 comentarios
Rik
Rik el 24 de Ag. de 2018
You should read the documentation for the functions mentioned, and/or post an example file and what form you want the variables to be.
cloudy snow
cloudy snow el 25 de Ag. de 2018
Thank you for your suggestion..I can solve it now.

Iniciar sesión para comentar.

Más respuestas (1)

Harshini Gangapuram
Harshini Gangapuram el 24 de Mzo. de 2019
Could you just share how were you able to do that?
  1 comentario
Rik
Rik el 24 de Mzo. de 2019
This is not an answer. Please post this as a comment on either answer or the question itself and then delete this answer.

Iniciar sesión para comentar.

Categorías

Más información sobre Text Data Preparation 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