matlab - How to put conversion operation in a for loop? -


below code convert .tim file ascii file 1 particular file. need convert 500 files(.tim). need save .ascii file in same name .tim file name below 500 files.

bin=fopen('file_01.tim','r');   ascii = fread(bin, [43,21000], 'float32');   data_values=ascii';   dlmwrite('file_01.xls', data_values, 'delimiter', '\t', ...      'precision', '%.6f','newline','pc'); 

using "for loop" conversion , save ascii file same name of tim, first thought don't know how that.

you can use dir list of filenames in folder , proceed have using replacing 'file_01.tim' [d(ii).name]

e.g.

d = dir('*.tim');  ii = 1:size(d,1)     bin=fopen(d(ii).name,'r');     %your processing etc     savename = [strtok(d(ii).name,'.'), '.xls']; %change file ext .tim .xls     dlmwrite(savename, ... 

 


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -