我正在嘗試僅在沒有任何 ui 的情況下獲取帶有路徑的檔案。
現在我正在使用
[file, path] = uigetfile('*.*');
我想要做的是簡單地獲取沒有 ui 的檔案。就像是
[file] = getfile(path)
有什么方法可以獲取該檔案,但格式也與 uigetfile 相同。
uj5u.com熱心網友回復:
要么你知道你的檔案在哪里和/或使用dir它的out.folder引數,它包含完整路徑,要么當你的檔案在你的當前作業目錄中時,使用pwd
my_folder = '/path/to/folder/';
files = dir(my_folder) % Grab all files
fullpath = [files(ii).folder files(ii).name]; % Generate full path
% Or, if the file is in the PWD
files = dir(my_folder) % Grab all files
fullpath = [pwd files(ii).name]; % Generate full path
uj5u.com熱心網友回復:
您可以使用命令 dir 獲取所有檔案的串列,以下代碼將顯示所有檔案的名稱:
files = dir;
files.name
然后,你必須得到你想要的檔案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/405290.html
標籤:
上一篇:通過netcat發送號碼
