How to rename a flash drive using matlab?

1 回表示 (過去 30 日間)
Daniya Zafar
Daniya Zafar 2022 年 5 月 11 日
コメント済み: Daniya Zafar 2022 年 5 月 11 日
I want to create a GUI using MATLAB appdesigner in which I can rename a connected flash drive.
Current name: USB DISK (E:)
NEW name:Sam's Flash Drive
Any suggestions are much appreciated.
Thanks

採用された回答

Jonas
Jonas 2022 年 5 月 11 日
this is possible via windows command line. You can access the windows command line via matlab using the system() command
system('label e: YourNewName')
  3 件のコメント
Daniya Zafar
Daniya Zafar 2022 年 5 月 11 日
Is it possible to have that 'e:' selection form a dropdown like so?
system('label' + app.DriveLetterDropDown.Value + 'Sams FD')
Thanks
Daniya Zafar
Daniya Zafar 2022 年 5 月 11 日
I figured it out.
  1. concatenate strings using strcat
  2. convert the resulting string to char
driveLetter = char(strcat("label " , app.DriveLetterDropDown.Value," Sams FD")); % results in 'label E: Sams FD'
cmd = system(driveLetter);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by