<div dir="ltr">Hi Rick,<div><br></div><div>Your method works well. Thanks.</div><div><br></div><div>Jian</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 6, 2017 at 11:43 PM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>Hi Jian,<br><br></div>I believe you may have found a bug in the case for this function when the output values should be a scalar. I need to confirm with my colleagues, and I'll file a ticket if so. In the mean time, a work around is to make the a,b,c,d variables the same dimension, and only use the 1st element of each on return from the function:<br><br></div>x = fspan(1,10,100)<br></div>a = x<br></div>b = x<br></div>c = x<br></div>d = floattoint(x)<br></div><div>d(0) = 1<br></div>;; Note that a,b,c,d are the same dimension, and effectively contain garbage values<br></div>stat_medrng(x,a,b,c,d)<br></div>print("median = " + a(0))<br>print("mid-value = " + b(0))<br>print("range = " + d(0))<br> <br><br></div>Hope that helps...<br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Apr 6, 2017 at 8:40 AM, Jian Zheng <span dir="ltr"><<a href="mailto:jzheng8606@gmail.com" target="_blank">jzheng8606@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi all,</div><div><br></div><div>When I use procedure stat_medrng, I get some errors. Below are some simple testing code</div><div><br></div><div>ncl 0> x=fspan(1,10,100)</div><div>ncl 1> a=0.</div><div>ncl 2> b=0.</div><div>ncl 3> c=0.</div><div>ncl 4> d=0</div><div>ncl 5> stat2(x,a,b,d)</div><div>ncl 6> stat_medrng(x,a,b,c,d)</div><div>fatal:stat_medrng: The dimensions of xmedian, xrange, xmrange, and nptused must be the same as the left-most dimensions of x</div><div>fatal:["Execute.c":8565]:Execu<wbr>te: Error occurred at or near line 6</div><div>ncl 8> stat4(x,a,b,c,c,d) <br></div><div><br></div><div>You can see it works well with stat2 or stat4, but not stat_medrng. How to define the output variables with stat_medrng for one-dimensional input?</div><div><br></div><div>Thanks,</div><div>Jian</div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>