convert multiple .txt into .mat in same folder
조회 수: 3 (최근 30일)
이전 댓글 표시
I want to automatically convert multiple .txt files in a folder into .mat file in same folder . How can i do it programmatically?
댓글 수: 2
Rik
2018년 8월 23일
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.
채택된 답변
Pierre845
2018년 8월 24일
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
Rik
2018년 8월 24일
You should read the documentation for the functions mentioned, and/or post an example file and what form you want the variables to be.
추가 답변 (1개)
Harshini Gangapuram
2019년 3월 24일
Could you just share how were you able to do that?
댓글 수: 1
Rik
2019년 3월 24일
This is not an answer. Please post this as a comment on either answer or the question itself and then delete this answer.
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Data Preparation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!