看板 MATLAB 關於我們 聯絡資訊
cd('yourMatFile') % 到你存檔案的路徑去 files = ls(); % list all files in directory files = files(~cellfun(@isempty, regexp(cellstr(files),'\.mat')), :); % capture the files you want to load wos=cell(size(files, 1), 1); for i = 1:size(files, 1) load(files(i, :)); wos{i, 1}=wo; end ※ 引述《xv5401778 (xv5401778)》之銘言: : 小弟matlab新手,因此爬文找不太到關鍵字QQ : 就是現在我有很大一筆.mat檔的data : 假設A.mat裡面有ar,pe,sh1,sh2,sh3,sh4,wo等七個矩陣的資料 : 而這樣的.mat檔案有84個,裡面的矩陣命名是一樣的(但資料是不同的) : 我想從這84個檔案都拿出wo這個矩陣(希望同時能改個名字) : ,重新存成一個.mat檔案,請問有比較簡單的方法嗎? : 我已經手動到有點崩潰,若有大神能幫忙十分感恩QQ : 先謝謝大家了 -- Sent from my Android -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.82.123.198 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1437675314.A.33B.html ※ 編輯: celestialgod (111.82.123.198), 07/24/2015 02:17:00 ※ 編輯: celestialgod (111.82.123.198), 07/24/2015 02:17:37
sunev: 直接wos{i, 1}=load(files(i, :),'wo'); ? 07/24 03:14
xv5401778: 感謝c大和s大 又學到新方法了! 07/24 07:40
xv5401778: 感恩 07/24 07:41