Programmatically ejecting an external hard drive

I'm currently running long scripts using data stored on multiple external hard drives connected via USB. My computer is smartcard-only, meaning that whenever I leave a script running and come back a while later, I have to "yank out" one of the cables in order to get back in. Often however the script actually finished hours before!
I'm wondering if there's a way to include an "eject hard drive" command at the end of the script. I did some searching of keywords and can't tell if this is possible in Matlab, or how to do so.

 채택된 답변

Jonas
Jonas 2021년 5월 18일
편집: Jonas 2021년 5월 18일

1 개 추천

you can combine matlab's system() function with the answer of

댓글 수: 2

This works perfectly, thank you. The final code is a one-liner -- on a Mac, it's
system('diskutil eject MyExternalDrive')
Jonas
Jonas 2021년 5월 19일
my bad, i assumed you are on a windows system ;)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Communications Toolbox에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2021년 5월 18일

댓글:

2021년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by