▲ 0 r/matlab
get around matlab's cd()
When profiling a script I noticed that cd() calls in a loop take a lot of time. Different parts of the loop operated on files in different folders, hence cd()'s inside that loop.
I fixed it by adding full paths to file names instead of cd'ing.
I read though that matlab's cd is slow because it does not just change pwd, it also scans that directory for any matlab files. Is there a way around it, i.e. to change the default directory for save/load/fopen etc but suppress that scanning? Sometimes cd might more convenient than full paths
u/IAmMDM — 5 days ago