MATLAB Answers

How do I find the path of an external hard drive plugged into my device with MatLab?

22 views (last 30 days)
Nathaniel Werner
Nathaniel Werner on 19 Apr 2018
Answered: Jan on 19 Apr 2018
I am using an external hard drive on multiple devices on the same network. I need to access data on a single external hard drive across these multiple devices.
I would like to have a few lines in my code before loading the data from this external hard drive that runs a search for the hard drive name without me having to change it every time I plug the hard drive into a different device.
Is there a way to do this?

Answers (1)

Jan on 19 Apr 2018
The answer depends on the used operating system. Under Windows you can check the existence of a file by changing the drive letter, but this does not work under MacOS and Linux.
If you are working in a network, a trivial solution is to share your device as a network folder. Then you can access it by the UNC path (under Windows): // .
Why do you want to search for the "hard drive name", especially "without me having to change it every time"? Does your hard drive has a different name for each access?


Community Treasure Hunt

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

Start Hunting!