![]() |
Can we configure MATLAB let variable have minium local scope?
<p>Can we configure MATLAB let variable have minium local scope?</p>
<p>I want matlab something similiar like C below.</p> <pre><code>% after some configure ... for i=1:1:100 a=i*i end % here we can not using 'a' any more for it have local scope in for loop. </code></pre> <p>Why I want it becase the scope in whole script sometimes leds to bug hard to find.</p> <p>For example:</p> <pre><code>% get accumulate of b via 100 times of x_0 b=0; for i=1:1:100 x0=100 b=b+x0 end % get accumulate of a via 100 times of x_0 a=0 for i=1:1:100 x_0=100 a=a+x0 %mistype x_0 to x0, and hard to find end </code></pre> <p>Thanks advance.</p> [url=https://stackoverflow.com/questions/59064467/can-we-configure-matlab-let-variable-have-minium-local-scope]More answer...[/url] |
所有时间均为北京时间。现在的时间是 21:34。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.