On Fri, Aug 19, 2011 at 9:37 AM, Trevor Porter <span dir="ltr">&lt;<a href="mailto:tjporter@connect.carleton.ca">tjporter@connect.carleton.ca</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal">Dear Arlindo:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I’ve been trying to run GrADS in Matlab, but haven’t had much success with the instructions you gave to another person in my shoes last year (<a href="http://gradsusr.org/pipermail/gradsusr/2010-November/011915.html" target="_blank"><span style="color:windowtext">http://gradsusr.org/pipermail/gradsusr/2010-November/011915.html</span></a>).  Here’s a summary of what I’ve done so far:<u></u><u></u></p>
<p class="MsoNormal"><u></u> </p></div></div></blockquote><div><br></div><div>Make sure this points to these instructions:</div><div><br></div><div><a href="http://opengrads.org/wiki/index.php?title=JyGrADS:_Java_and_Matlab_interface_to_GrADS_through_Jython">http://opengrads.org/wiki/index.php?title=JyGrADS:_Java_and_Matlab_interface_to_GrADS_through_Jython</a></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal"><u></u></p><p class="MsoNormal">1) I confirmed that Java Virtual Machine is installed and running on my computer.  This can be done from the command line in Matlab using the following command: javachk(‘jvm’);<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><pre><span style="font-size:11.0pt">2) I downloaded the <span style="background:white">jygrads-superpack.jar and unzipped it into a directory I created ‘GrADS’ using the command: unzip jygrads-superpack.jar; This extracted 6 folders (com, javatests, jxxload_help, Lib, META-INF, and org).<u></u><u></u></span></span></pre>
<pre><span style="font-size:11.0pt;background:white"><u></u> </span></pre></div></div></blockquote><div><br></div><div>Although this may cause no harm, do not unzip. Keep the jar intact as this is how I tested it.</div><div>
<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div lang="EN-CA" link="blue" vlink="purple"><div><pre><span style="font-size:11.0pt;background:white"><u></u></span></pre>
<p class="MsoNormal" style="text-autospace:none"><span style="background:white">3) I added the following 2 lines to my startup file:  </span>path(&#39;c:\Users\owner\Documents\MATLAB\GrADS&#39;,path); javaaddpath(&#39;c:\Users\owner\Documents\MATLAB\GrADS\jygrads-superpack.jar&#39;);<u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none"><u></u> <u></u></p><p class="MsoNormal" style="text-autospace:none">4) I downloaded the latest GrADS binary file for Windows (which was designed for CYGWIN), and untarred it inside the GrADS directory I created.  </p>
</div></div></blockquote><div><br></div><div>Unless you are doing tricky DLL stuff, the fact that cygwin is involved should not matter. Jygrads talks to grads through pipes, no dynamic linking involved. This is the same method used by pygrads which does work under windows.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal" style="text-autospace:none">This created a ‘bin’ folder with all the GrADS executables.<u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none"><u></u></p></div></div></blockquote><div><br></div><div>Oops, I never tested this under windows. It should work though, but I never tried it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal" style="text-autospace:none"> <u></u></p><p class="MsoNormal" style="text-autospace:none">5) I created the grads.m file you posted online (<a href="http://opengrads.org/devel/jygrads/" target="_blank"><span style="color:windowtext">http://opengrads.org/devel/jygrads/</span></a>) and saved it to my GrADS directory.<u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none"><u></u> <u></u></p><pre><span style="font-size:11.0pt">6) I then tried to start GrADS using the commands you provided: <span style="background:white">ga = grads(&#39;grads -lb&#39;,0); However, this command did not work, and I was given an error which I cannot figure out:<u></u><u></u></span></span></pre>
<pre><span style="font-size:11.0pt;background:white"><u></u> <u></u></span></pre><pre><span style="font-size:11.0pt;background:white">??? Error: File: grads.m Line: 1 Column: 10<u></u><u></u></span></pre><pre><span style="font-size:11.0pt;background:white">A class definition must be in an &quot;@&quot; directory.<u></u><u></u></span></pre>
<p class="MsoNormal" style="text-autospace:none"><span style="background:white"><u></u> </span></p></div></div></blockquote><div><br></div><div>Which version of Matlab do you have?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal" style="text-autospace:none"><span style="background:white"><u></u></span>I am not familiar with class definition in Matlab, and haven’t been able to figure it out using the help files.  If you can help me troubleshoot this problem, I would be most grateful.<u></u><u></u></p>
<p class="MsoNormal"><u></u> </p></div></div></blockquote><div><br></div><div>Classes and objects in matlab are afterthoughts, kind of clumsy. This is the reason why I have converted my stuff to run with pylab under python. It appears that the jar is not being read properly. It could also be a matlab version issue. I also need to know which metthod you used to install the jar (unzipped): dynamically or statically?</div>
<div><br></div><div>And please, send questions like these to the list.</div><div><br></div><div>   Arlindo</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-CA" link="blue" vlink="purple"><div><p class="MsoNormal"><u></u></p><p class="MsoNormal">Best regards,<u></u><u></u></p><p class="MsoNormal">Trevor<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">
<span style="font-size:10.5pt;font-family:Consolas">Trevor J. Porter, Ph.D. Candidate<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas">Carleton University Paleoecology Laboratory<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas">Department of Geography and Environmental Studies<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas">1125 Colonel By Drive<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Consolas">Ottawa, Ontario<u></u><u></u></span></p><p class="MsoNormal">Canada K1S 5B6<u></u><u></u></p><p class="MsoNormal"><a href="tel:613-520-2600%20ext.%201836" value="+16135202600" target="_blank">613-520-2600 ext. 1836</a><u></u><u></u></p>
<p class="MsoNormal"><a href="http://tjporter.webs.com/" target="_blank">http://tjporter.webs.com/</a><u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div></blockquote></div><br><br clear="all"><div><br></div>
-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a><br>