Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用函数 repmat 来编写这段代码:
for j=1:30 for i=1:10 myObject{i,j}.s = zeros(6,1); end end
我不明白如何为细胞做到这一点。任何人都可以帮助我吗?
您可以使用deal:
deal
[myObject{1:10,1:30}] = deal( struct('s',zeros(6,1) );
PS:最好不要在Matlab中使用iandj作为变量。
i
j