MATLAB: While loop until x amount correct digits while Hi Can someomene give me an example or an general way to write a while loop where the condition is that you need to have 3 correct decimals. ? In my code I have a for loop but I need to make it more adapt. Best Answer Have you considered using built-in function 'round'?https://www.mathworks.com/help/matlab/ref/round.htmlThen you can just do:if round(x,3) == round(y,3) ...end Related SolutionsMATLAB: I am having a problem getting values to iterate with a while loop. u2(n+1) = uc(n); u3(n+1) = uv(n); u4(n+1) = ut(n); u5(n+1) = ui(n); h = u5(n+1);But it seems your algorithm needs improvement MATLAB: How can i find layer number?? After calculating min(:) and max(:). I want to know layer number for layer calculation in Lakhs of layer. [maxta1, maxidx] = max(ta1);[minta1, minidx] = min(ta1);That minidx and maxidx would be layer numbers.However, I do not understand about Lakhs in this? Lahks I understand is 10^5 but you only have 50 layers. Are you looking for maxidx/10^5 ? Related QuestionConditional loop to loop until result is an integer.Anonymous functions not acting as they shouldFormula for the exact solution u1(u) and u2(t)For loop nested in while loop problemHow to evaluate the inifinite sum using a while loop
Best Answer