MATLAB Answers

Code for saving files as .mat is very very slow

조회 수: 24(최근 30일)
Curious Mind
Curious Mind 30 Jun 2020
Hi,
I am loading multiple .csv files into matlab and re-saving them as .mat files. The code takes way too long (hours) to save each file as a .mat file. Code is below:
myfiles = dir('*.txt') ;
p = length(myfiles) ;
for i = 1:p
thisfile = myfiles(i).name ;
y = importdata(thisfile) ;
matfile = strcat(thisfile,'.mat')
save(matfile,'y') ;
clearvars y
end
Any hint or help?
Thank you
  댓글 수: 10
Walter Roberson
Walter Roberson 1 Jul 2020
save(matfile, '-struct', 'y') ;

댓글을 달려면 로그인하십시오.

답변(0개)

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by