[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help Calling Java from Matlab

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: Re: Help Calling Java from Matlab
  • Date: Tue, 10 Jul 2007 10:18:30 +0100

Roger,
Having said it was simple I thought I ought to have a go at getting a primitive 
class type directly into Matlab - and failed.

You will need a static method in a class somewhere, I think

viz
  package yourPackage;
  public class pC{
  public static Class primitiveClass(char type){
    switch(type){
    case 'I': return int.class;
    case 'D': return double.class;
    case 'F': return float.class;
    default: throw new Error("Unrecognised type " + type);  
      }}
    }

In Matlab
  floatType  =  yourPackage.pC.primitiveClass('F');

Steve



-- 
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.

==============================================================================To
 unsubscribe netcdf-java, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
=============================================================================