Info
この質問は閉じられています。 編集または回答するには再度開いてください。
What code opens folders on my computer
2 ビュー (過去 30 日間)
古いコメントを表示
Is there a way to open a folder using MATLAB I am working on a talking program where I ask it to look for a file in my folder.
so far I have:
command=input('Located file');
if strcmpi(command,'Located file')
NET.addAssembly('System.Speech');
obj = System.Speech.Synthesis.SpeechSynthesizer;
obj.Volume = 100;
Speak(obj, 'Here it is');
end
And I would want it to open the folder.
0 件のコメント
回答 (1 件)
Walter Roberson
2018 年 7 月 22 日
Open the folder in what sense?
If you had the name of a directory and you were using MS Windows, then you could probably use
winopen(VariableThatContainsDirectoryName);
On Mac you could use something like,
system( sprintf('open "%s"', VariableThatContainsDirectoryName) );
Or perhaps you would prefer
cd(VariableThatContainsDirectoryName);
folderbrowser
2 件のコメント
Walter Roberson
2018 年 8 月 5 日
[filename, filepath] = uigetfile('*.*', 'Pick a file');
if ~ischar(filename); return; end %user canceled
fullname = fullfile(filepath, filename);
winopen(fullname)
That would rely upon MS Windows to open it with the default program for that type of file.
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!