Why does the same code that runs on HDD doesn't run on SSD?
Show older comments
I pass data between Matlab and another software by writing it in a file. I have a loop in the code that very much looks like this:
for i = 1:100
fid = fopen('test.dat','w');
fprintf(fid,'#Data Generated %s \n\n',datestr(now));
fclose(fid);
delete('test.dat');
end
I have both HDD and SSD on my computer. if I run the code from SSD, it runs into trouble somewhere in the loop (a different iteration each time). It seems that it cannot generate the file id (returns -1). If I copy the exact same file on the HDD, it runs fine. My guess is that for some reason Matlab is going faster than the OS (Windows 10) -- trying to create a file with the same name before the OS is done deleting it. If i use a while loop around fopen command, it runs fine, but that doesn't seem efficient and it would make things more complex, especially in my main code that is much messier.
Since running the code on SSD is much faster, I would prefer that. Any ideas how to solve the issue?
Thanks!
Answers (0)
Categories
Find more on Convert Image Type 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!