看板 MATLAB 關於我們 聯絡資訊
這是把struct當成array來處理的範例: datas = repmat(struct('x', [], 'y', []), 100, 1) for i = 1:100 numData = randsample(10:100, 1); datas(i).x = randn(numData, 1); datas(i).y = 1 + datas(i).x* 2 + randn(numData, 1); end lmModels = arrayfun(@(d) fitlm(d.y, d.x), datas, 'uni', false); 這是之前某位大神po的code 小弟想問的是最後一行 lmModels = arrayfun(@(d) fitlm(d.y, d.x), datas, 'uni', false); 是什麼意思呢? 請各位大大指教 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.138.26.106 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1510305429.A.B90.html