采纳的回答

Matt J
Matt J 2021-12-26
编辑:Matt J 2021-12-27
Perhaps this is what you want,
sub=repmat({':'},1,n);
sub(i)={1};
Y=W(sub{:});

2 个评论

Nice code, bro. But the second line should be changed into sub{i} = l ;
Matt J
Matt J 2021-12-27
编辑:Matt J 2021-12-27
You're right, and I've edited the answer accordingly, but please Accept-click the answer if it provided what you needed.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息

产品

版本

R2014b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by