[Nexus] NeXus Digest, Vol 58, Issue 5
Brian Tieman
tieman at aps.anl.gov
Mon Apr 19 14:38:45 BST 2010
On 4/19/2010 7:51 AM, Mark Koennecke wrote:
> Dear Brian Pauw,
>
> Brian Pauw wrote:
>> Dear Freddie,
>>
>> The timescale I was thinking of was on the order of within several
>> months. Would this be feasible? I am looking into the HDF file format
>> option at the moment. The key issue is not just reading but reading
>> _and_ writing (as I don't have nexus files yet and no way to generate
>> them).
>>
>> Yours sincerely,
>>
>>
> In an idle moment I looked at the matlab documentation for a bit,
> especially the external interface.
> I realized that matlab can use external Java classes. If this really
> works (I have no time now to test
> this) then you may use the existing NeXus-Java binding. It will
> require some conversion from matlab
> to Java arrays but I would not be surprised if a utility function for
> doing this exists somewhere.
> A conversion would anyway be required as NeXus uses C-storage order
> whereas matlab uses
> Fortran storage order.
>
I use Matlab to call java classes. It works really well. Matlab has a
classpath.txt file that one needs to modify to add in the new jar
files. Once they are added in, one can create a Matlab "class" with a
command like:
client = gov.anl.aps.tieman.mpicorrelator.client.matlab.MatlabClient ()
A call to
methods (client)
will then return all the methods in the java class
gov.anl.aps.tieman.mpicorrelator.client.matlab.MatlabClient (). The
methods can be easily called from Matlab. For example, the method
public int[][] getDynamicPartitionMap(String libraryPath, String
mapName)
can be called from Matlab with the call
dynamicPartitionMap = client.getDynamicPartitionMap
(partitionMapLibraryPath, partitionMapFiles(3));
Mark is right, the arrays are fortran ordered in Matlab so may need to
be flipped somewhere. You also need to be mindful of the data types as
Java is a strongly typed language.
I'm calling java from Matlab to open Nexus files in a round-a-bout sort
of way. Matlab is calling java classes that wrapper service calls to
Jax_WS services on a server. It is the Jax-WS services that are opening
the nexus files. Certainly if Matlab can't interface to the Java HDF
routines directly--or you wish to flip the dims or do some other
activities outside of Matlab--writing a java wrapper for Matlab to call
instead is feasible.
Brian
> Best Regards,
>
> Mark Koennecke
>
>> Brian.
>>
>> On 15 Apr 2010, at 20:00, nexus-request at nexusformat.org wrote:
>>
>>> What sort of timescale were you looking at to start using NeXus
>>> files?
>>
>> Yours sincerely,
>>
>>
>> Brian R. Pauw.
>
> _______________________________________________
> NeXus mailing list
> NeXus at nexusformat.org
> http://lists.nexusformat.org/mailman/listinfo/nexus
More information about the NeXus
mailing list