> I believe that the issue may be that you don?t have an Excel converter which 
> xlsread can use.  I?m not sure (1) what libraries are acceptable, and (2) 
> whether we have them in Fink or not.
> 
> -- 
> Alexander Hansen, Ph.D.
> Fink User Liaison

Good Morning Alexander,

After much searching and trying, I finally found the solution. You were 
correct: an additional library or more precisely, Java class library is 
required as the interface for importing the *.xls files. I found a solution by 
calling the POI Java-based class library <https://poi.apache.org/>. Following 
is an example:

octave:3> chk_spreadsheet_support
ans = 0

octave:4> javaclasspath
   STATIC JAVA PATH

      - empty -

   DYNAMIC JAVA PATH

      - empty -

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home

octave:8> javaaddpath 
('/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home')


$ octave
GNU Octave, version 3.8.2
Copyright (C) 2014 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-apple-darwin".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> cd ~/Documents/MATLAB

octave:2> chk_spreadsheet_support
error: 'chk_spreadsheet_support' undefined near line 1 column 1

octave:2> pkg load all
warning: function /sw/share/octave/3.8.2/packages/specfun-1.1.0/ellipke.m 
shadows a core library function
warning: function /sw/share/octave/3.8.2/packages/specfun-1.1.0/erfcinv.m 
shadows a built-in function
warning: function /sw/share/octave/3.8.2/packages/specfun-1.1.0/expint.m 
shadows a core library function
warning: function 
/sw/lib/octave/3.8.2/packages/specfun-1.1.0/x86_64-apple-darwin-api-v49+/ellipj.oct
 shadows a built-in function

octave:3> chk_spreadsheet_support
ans = 0

octave:4> javaclasspath
   STATIC JAVA PATH

      - empty -

   DYNAMIC JAVA PATH

      - empty -

octave:5> setenv 
("JAVA_HOME","/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home")

octave:6> javaclasspath
   STATIC JAVA PATH

      - empty -

   DYNAMIC JAVA PATH

      - empty -

octave:7> javaaddpath 
('/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home')

octave:8> javaclasspath
   STATIC JAVA PATH

      - empty -

   DYNAMIC JAVA PATH

      /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home

octave:9> M1 = xlsopen ('MATRIX1.xls')
Detected XLS interfaces: None.
warning: xlsopen.m: no support for spreadsheet I/O

M1 = [](0x0)

octave:10> javaaddpath (‘~/Desktop/poi-3.14')

octave:11> javaclasspath
   STATIC JAVA PATH

      - empty -

   DYNAMIC JAVA PATH

      /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
      ~/Desktop/poi-3.14

octave:15> chk_spreadsheet_support
ans = 0

octave:16> javaaddpath(‘~/Desktop/poi-3.14/poi-3.14-20160307.jar')

octave:17> chk_spreadsheet_support
ans = 0

octave:18> javaclasspath
   STATIC JAVA PATH

      - empty -

   DYNAMIC JAVA PATH

      /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
      ~/Desktop/poi-3.14
      ~/Desktop/poi-3.14/poi-3.14-20160307.jar

octave:19> javaaddpath(‘~/Desktop/poi-3.14/poi-ooxml-3.14-20160307.jar')

octave:20> javaclasspath
   STATIC JAVA PATH

      - empty -

   DYNAMIC JAVA PATH

      /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
      ~/Desktop/poi-3.14
      ~/Desktop/poi-3.14/poi-3.14-20160307.jar
      ~/Desktop/poi-3.14/poi-ooxml-3.14-20160307.jar

octave:21> chk_spreadsheet_support
ans =  2

octave:22> M1 = xlsopen('MATRIX1.xls')
Detected XLS interfaces: POI*; (* = default interface)
M1 =

  scalar structure containing the fields:

    xtype = POI
    app =

<Java object: java.io.FileInputStream>

    filename = MATRIX1.xls
    workbook =

<Java object: org.apache.poi.hssf.usermodel.HSSFWorkbook>

    changed = 0
    limits = [](0x0)


octave:24> chk_spreadsheet_support
ans =  2

octave:25> M2 = xlsread('MATRIX2.xls')
M2 =

   3.50000
   0.00000
       NaN
   0.50000
       NaN
       NaN
   2.50000
       NaN
       NaN
   0.00000
   3.00000
       NaN
   0.00000
   3.00000
       NaN
   2.50000
   1.00000
   1.00000
   4.00000
   2.50000
   2.50000

octave:26> M1 = xlsread('MATRIX1.xls')
M1 =

   4.00000
   0.00000
       NaN
   3.00000
   4.00000
       NaN
   3.00000
   3.50000
       NaN
   3.00000
   3.50000
   3.00000
   3.50000
   4.00000
       NaN
   3.00000
   3.50000
   3.50000
       NaN
   4.00000

octave:27> size(M1)
ans =

   1603      1

octave:28> size(M2)
ans =

   1603      1

octave:29> length(M1)
ans =  1603

octave:30> length(M2)
ans =  1603

Have a great weekend,
Ebrahim
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
Fink-users mailing list
Fink-users@lists.sourceforge.net
List archive:
http://news.gmane.org/gmane.os.macosx.fink.user
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-users

Reply via email to