More efficient code for placing variables in one line?

2 次查看(过去 30 天)
Hi,
I've been looking for a while but I can t find any solution. Is there surely a better way than this to define elements:
j= j+1;
MMG(j, 1)=j;
MMG(j, 2)=1;
MMG(j, 3)=xc + r
MMG(j, 4)=xc - r
MMG(j, 5)=yc + r
MMG(j, 6)=yc - r
Apologies, this is probably basic, I couldn't find anything

采纳的回答

the cyclist
the cyclist 2013-5-3
编辑:the cyclist 2013-5-3
MMG(j,1:6) = [j,1,xc+r,xc-r,yc+r,yc-r];

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by