How can I use a OneDrive folder on path functions in MATLAB R2024b?

13 views (last 30 days)

I have a folder in OneDrive. In MATLAB R2024b, how can I use "cd", "addpath", and similar functions on this folder?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Apr 2025
OneDrive folders can be treated like normal folders in a filepath. Here's an example use case with "cd":
cd("C:\Users\jdoe\OneDrive - MathWorks\Documents\Project")
There are many ways to get the path to your OneDrive folder. Here are two convenient methods:
  • Navigate to your OneDrive folder in Windows File Explorer. From here, you can copy the full path into MATLAB.
  • Use "getenv" to get the full path to your root OneDrive folder:
    getenv('OneDrive')
    or for a corporate license:
    getenv('OneDriveCommercial')

More Answers (0)

Categories

Find more on Search Path in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!