作者s4300026 (s4300026)
看板MATLAB
標題[討論] struct a.b([1:5]).c=1; 為什麼錯?
時間Mon Jun 29 17:34:40 2015
如題
我想要做到
a.b(1).c = 1
a.b(2).c = 1
a.b(3).c = 1
a.b(4).c = 1
a.b(5).c = 1
就很順手的打
a.b([1:5]).c=1;
然後就得到
Insufficient outputs from right hand side to
satisfy comma separated list expansion on left hand
side. Missing [] are the most likely cause.
該怎麼改成正確呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.123.121.126
※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1435570483.A.808.html
→ celestialgod: field不能這樣操作 06/29 17:36
→ s4300026: 所以此題無解 只能用for了? 06/29 17:41
→ celestialgod: 用cell轉比較快 06/29 17:47
→ celestialgod: 看下面回文 06/29 17:47