jeudi 2 octobre 2014

Want to write while loop using for loop


Vote count:

0




In C++ for loop is same as while loop



for(int i=0; i<10; i++)
{
}

int j;
while(j<10)
{
cout<<" ";
j++;
}


I want to convert this for loop in while loop using Matlab Here is the code.



for i = 2:zoom_r - 1
for j = 2:zoom_c - 1
conv = [zoom_lena(i-1,j-1) zoom_lena(i-1,j) zoom_lena(i-1,j+1);
zoom_lena(i,j-1) zoom_lena(i,j) zoom_lena(i,j+1);
zoom_lena(i+1,j-1) zoom_lena(i+1,j) zoom_lena(i+1,j+1)];

productVal = double(conv).*conv_mask;
sumVal = sum(sum(productVal));
fin_lena(i,j) = sumVal;
end
end


asked 2 mins ago







Want to write while loop using for loop

Aucun commentaire:

Enregistrer un commentaire