MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > Replacing for loops 

I have been attempting to write a programme to run through all possible combinations of elements from two lists and add the results of a calculation on each pair together. the following is my current code, which works: 
"Charles Dillon" wrote in message <it7vvt$es8$1@newscl01ah.mathworks.com>... 
A bit off topic but you should avoid using the variable ans. It is already 
"Charles Dillon" wrote in message <it7vvt$es8$1@newscl01ah.mathworks.com>... 
"Corey Scheip" wrote in message <it815a$ij2$1@newscl01ah.mathworks.com>... 
"Shawn Bonneau" <sbonneau@mathworks.com> wrote in message <it820l$knj$1@newscl01ah.mathworks.com>... 
"Roger Stafford" wrote in message <it85a0$1mp$1@newscl01ah.mathworks.com>... 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.