How to Bypass OneDrive Files Download

20 views (last 30 days)
Milos Krsmanovic
Milos Krsmanovic on 20 Sep 2025
Edited: Milos Krsmanovic on 22 Sep 2025
I just installed MATLAB on my work laptop with Windows 11. The org uses OneDrive for file storage. My OneDrive is set to only download files when they are opened ("Always keep on this device" is checked off).
What I discovered was that MATLAB insists on downloading all the files in the folder where I want to navigate to to save my script. As in, if I want to save the script in the folder OneDrive/Documents/Some Folder, and there is like 20GB of other files in that folder, MATLAB will trigger download of all 20GB of other files before it will even let me save my one file.
What's even worse, when I cancel the automatic download MATLAB freezes. If I Block App in automatic downloads MATLAB freezes. After it freezes the only way to close it is force quit through the Task Manager. So my options are: I let MATLAB download whatever it wants as I navigate through my OneDrive, or freeze the program by cancelling the downloads.
I haven't used MATLAB since v. 2021 and this behavior is new for me. Is there anything I can do to use the software without downloading files to local drive? I simply do not have space for that (nor the time to download GB of files each time I want to move around my OneDrive). I can use admin account but only temporarily, after coordinating with the IT department.
I found a couple of threads here on this topic but nothing that answers my question. Thank you in advance.

Answers (1)

Walter Roberson
Walter Roberson on 20 Sep 2025
There is a work-around, but you are not going to like it.
The work-around is to not navigate to save your script. Instead, save() specifying the relative path or the fully qualified path.
As you navigate around, you are effectively doing a cd(), and each time you cd(), MATLAB scans all of the .m files in the new directory in order to properly populate the function pointers... since if, for example, you were to navigate to somewhere that contained (say) disp.m then that disp.m would take priority over the MATLAB disp() function.
  3 Comments
Walter Roberson
Walter Roberson on 20 Sep 2025
Never make large OneDrive directories your current folder.
Use the "-sd" startup option to temporarily set your starting directory to something other than the remembered starting directory to avoid this problem at startup. https://www.mathworks.com/help/matlab/ref/matlabwindows.html
Milos Krsmanovic
Milos Krsmanovic on 22 Sep 2025
Edited: Milos Krsmanovic on 22 Sep 2025
> Never make large OneDrive directories your current folder.
Not a choice I'm afraid as virtually all my folders, including the Documents folder, are defaulting to OneDrive. Which I believe is the norm for most orgs nowadays. I appreciate the tip on the -sd command, I wasn't aware that was an option.
I can see threads on this since 2021. In case anyone else encounters a similar issue in future, I tried these two things and they both worked just fine:
  1. Right click in Windows Explorer -> Open with -> MATLAB 2024b. I was able to edit the script and run it. To run a script from another folder I had to go through the Explorer again.
  2. I'm using Visual Studio Code so I tried the MATLAB extension. I navigated to the folder in VSC and opened the script and ran it from there. Only the plot MATLAB window pops up so no issues with the navigation.

Sign in to comment.

Tags

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!