Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

More efficient code for placing variables in one line?

Asked by Brian

Brian (view profile)

on 3 May 2013

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

0 Comments

Brian

Brian (view profile)

Products

1 Answer

Answer by the cyclist

the cyclist (view profile)

on 3 May 2013
Edited by the cyclist

the cyclist (view profile)

on 3 May 2013
Accepted answer
MMG(j,1:6) = [j,1,xc+r,xc-r,yc+r,yc-r];

1 Comment

Brian

Brian (view profile)

on 3 May 2013

Thanks

the cyclist

the cyclist (view profile)

Contact us