[討論] 有關於arrayfun處理struct array的問題

看板MATLAB作者 (wdw0925)時間6年前 (2017/11/10 17:17), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
這是把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
文章代碼(AID): #1Q1MwLkG (MATLAB)
文章代碼(AID): #1Q1MwLkG (MATLAB)