Hey guys, in matlab when u do a loop(something like this):

for i=1:3
a= 2*i
end

You get a=2
a=6
a=9
any idea how do i assign the 3 answers(a) names so that i can calculate the product of all 3 answers?

Hey guys, in matlab when u do a loop(something like this):

for i=1:3
a= 2*i
end

You get a=2
a=6
a=9
any idea how do i assign the 3 answers(a) names so that i can calculate the product of all 3 answers?

Maybe:

a = 0
for i=1:3
 a= a * (2*i)
 end
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.