Clear Filters
Clear Filters

Alternative for fopen and dlmwrite

3 views (last 30 days)
Mahi Nazir
Mahi Nazir on 18 Mar 2015
Edited: Mahi Nazir on 19 Mar 2015
I have a large number of small .out files to be written. There are several for loops going on. A snippet:
outputfile=sprintf('AF_w.r.t_Sensor%d,Target%d at (%d,%d) and RV lines at (%.1f) .out',Col,target,txc,ty,R(Row,Col));
fid=fopen(outputfile,'w'); .. ... ... ... dlmwrite(outputfile,intersection,'-append','delimiter','\t') ... ...
fopen in write mode allows me to open a file so I can rewrite new data, erasing the old one every time I run the program and dlmwrite allows me to write data...
There is a serious performance issue with this code... it takes several minutes for each fopen and dlmwrite to execute for the number of files I have (several thousand files). How can I improve the performance? Please advice..
These files are then later accessed by other programs. Is there a way where i may not use files and store somewhere else like matrices.... can they later be accessed by other programs... but i have named eah file with sprintf... how will i identify the matrix in case i am able to use that
Thanks Mahi

Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!