jessysmith8109 jessysmith8109
  • 23-08-2019
  • Computers and Technology
contestada

convert for loop to while loop, that is the script

z1=zeros(10);
for x=1:10
for y=1:10
z1(x,y)=x^2-3*y
end
end
z1

Respuesta :

ExieFansler ExieFansler
  • 04-09-2019

Answer:

To convert for loop to while loop we have to first declare and initialize the integers or variables that will work as an counter.

script will be

z1=zeros(10);

x=1

while x<10

y=1

while y<10

z1(x,y)=x^2-3*y

y=y+1

end

x=x+1

end

z1

Remember that we have to update the counter every time that we not need to be done for loop.

Answer Link

Otras preguntas

In what way did the Quran affect the role of Islamic women?
What chemical processes do producers and consumers share and do not share
Cuando el chofer del bus se baja , como cierra la puerta ??
jesse has recently started using methamphetamines. which of the follow is he risking by taking this drug
I need help with these four problems?
What is (-7)^5 in expanded form?
What is the opinion
At the time of the Missouri Compromise, there was conflict between the North and the South because of A. opposition to Manifest Destiny. B. differences in the
how do I solve a 90° rotation about the origin
what is the lowest term of 8/12?