help-octave
[Top][All Lists]
Advanced

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

Re: Windows Package


From: Martin Helm
Subject: Re: Windows Package
Date: Thu, 22 Jul 2010 21:58:22 +0200
User-agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; )

Am Donnerstag, 22. Juli 2010 19:27:25 schrieb John Hudock:
> I have done some additional tests and am even more confused. The COM
> functions all seem to work, but for some reason can't be assigned (except
> indirectly).
> 
> >>> wb=app.Workbooks.Open("C:\\OctaveTest.xls");
> >>>error: can't perform indexing operations for octave_com_object type  //
> 
> Error
> 
> >>> app.Workbooks.Open("C:\\OctaveTest.xls")  // But call works
> 
> ans =
> 
> <COM object _Workbook (0x0x260224)>
> 
> >>> wb
> >>>error: `wb' undefined near line 17 column 1
> >>> ans
> 
> ans =
> 
> <COM object _Workbook (0x0x260224)>
> 
> >>> wb=ans     // And I can assign ans to wb even though i can't assign
> >>> original call
> 
> wb =
> 
> <COM object _Workbook (0x0x260224)>
> 
> >>> wb
> 
> wb =
> 
> <COM object _Workbook (0x0x260224)>
> 
> >>> sh = wb.Worksheets("Sheet1");   // Same problem, can't assign
> >>>error: can't perform indexing operations for octave_com_object type
> >>> wb.Worksheets("Sheet1")
> 
> ans =
> 
> <COM object _Worksheet (0x0x2603b4)>
> 
> >>> sh  = ans    // but can do call and assign ans
> 
> sh =
> 
> <COM object _Worksheet (0x0x2603b4)>
> 
> >>> sh.Range("A2:D50")
> 
> ans =
> 
> <COM object Range (0x0x258d9c)>
> 
> >>> r = ans
> 
> r =
> 
> <COM object Range (0x0x258d9c)>
> 
> >>> r.Value
> 
> ans =
> 
> {
>   [1,1] = -2
>   [2,1] =  1.0200
>   [3,1] =  3.0300
>   [4,1] = -11.760
>   [5,1] = -3.3300
>   [6,1] =  1.1500
>   [7,1] = 0
>   [8,1] = -1.1400
>   [9,1] = -1.1500
>   [10,1] = 0
>   [11,1] = -2.3300
>   [12,1] = 0
>   [13,1] =  4.7600
>   [14,1] =  4.5500
>   [15,1] =  7.6100
>   [16,1] =  5.0500
>   [17,1] = -0.96000
>   [18,1] =  9.7100
>   [19,1] = 0
>   [20,1] = -7.0800
>   [21,1] =  3.8100
>   [22,1] = -4.5900
>   [23,1] =  6.7300
>   [24,1] =  12.610
>   [25,1] =  8
>   [26,1] =  8.8900
>   [27,1] =  4.7600
>   [28,1] =  5.1900
>   [29,1] =  8.0200
>   [30,1] =  4
>   [31,1] =  8.2400
>   [32,1] =  2.0300
>   [33,1] =  4.4800
>   [34,1] =  3.3300
>   [35,1] =  17.510
>   [36,1] =  8.6300
>   [37,1] =  1.4400
>   [38,1] =  8.5400
>   [39,1] = 0
>   [40,1] = -11.150
>   [41,1] =  2.2100
>   [42,1] =  1.8100
>   [43,1] =  6.0300
>   [44,1] = -5.0200
>   [45,1] = -5.6300
>   [46,1] = -0.37000
>   [47,1] = -14.230
>   [48,1] = -5.6800
>   [49,1] = -0.46000
>   [1,2] =  5
>   [2,2] =  6.6700
>   [3,2] =  3.5700
>   [4,2] = 0
>   [5,2] = -3.4500
>   [6,2] =  4.4600
>   [7,2] =  7.6900
>   [8,2] =  3.9700
>   [9,2] = -2.2900
>   [10,2] = -3.1200
>   [11,2] =  4.0300
>   [12,2] =  6.9800
>   [13,2] =  5.0700
>   [14,2] = -5.5200
>   [15,2] =  0.73000
>   [16,2] =  7.2500
>   [17,2] =  8.1100
>   [18,2] =  21.250
>   [19,2] = -1.5500
>   [20,2] =  18.320
>   [21,2] =  5.7500
>   [22,2] = -2.5100
>   [23,2] = -24.030
>   [24,2] =  22.030
>   [25,2] = -0.93000
>   [26,2] =  3.2700
>   [27,2] =  4.5200
>   [28,2] =  11.690
>   [29,2] =  8.9100
>   [30,2] =  4.9800
>   [31,2] =  8.8100
>   [32,2] = -7.7900
>   [33,2] =  8.7800
>   [34,2] =  28.570
>   [35,2] =  5.0700
>   [36,2] =  27.820
>   [37,2] =  16.910
>   [38,2] =  87.850
>   [39,2] = -21.050
>   [40,2] = -42.320
>   [41,2] =  1.9800
>   [42,2] = -15.170
>   [43,2] =  10.400
>   [44,2] = -14.310
>   [45,2] = -10.330
>   [46,2] =  15.200
>   [47,2] = -15.320
>   [48,2] = -16.580
>   [49,2] =  5.4200
>   [1,3] =  3
>   [2,3] = -2.9100
>   [3,3] = -1
>   [4,3] = -6.0600
>   [5,3] = -3.2300
>   [6,3] = -2.2200
>   [7,3] =  5.6800
>   [8,3] = -1.0800
>   [9,3] = -3.2600
>   [10,3] =  1.1200
>   [11,3] = -1.1100
>   [12,3] =  2.2500
>   [13,3] =  4.4000
>   [14,3] = -1.0500
>   [15,3] = -2.1300
>   [16,3] = 0
>   [17,3] =  5.4300
>   [18,3] = -2.0600
>   [19,3] =  2.1100
>   [20,3] = -3.0900
>   [21,3] = -8.5100
>   [22,3] = -6.9800
>   [23,3] =  6.2500
>   [24,3] =  3.5300
>   [25,3] =  6.8200
>   [26,3] =  6.3800
>   [27,3] =  12
>   [28,3] =  2.6800
>   [29,3] =  5.2200
>   [30,3] = -4.1300
>   [31,3] =  6.9000
>   [32,3] = 0
>   [33,3] = -1.6100
>   [34,3] = -4.1000
>   [35,3] = -6.8400
>   [36,3] = -2.7500
>   [37,3] =  6.6000
>   [38,3] =  13.270
>   [39,3] =  5.4700
>   [40,3] =  6.6700
>   [41,3] =  2.7800
>   [42,3] =  3.3800
>   [43,3] = -5.8800
>   [44,3] = -8.3300
>   [45,3] =  2.2700
>   [46,3] =  1.4800
>   [47,3] = -18.250
>   [48,3] = -5.3600
>   [49,3] = 0
>   [1,4] = -6
>   [2,4] = -3.1900
>   [3,4] =  1.1000
>   [4,4] = -4.3500
>   [5,4] = -10.230
>   [6,4] = -3.8000
>   [7,4] =  6.5800
>   [8,4] = 0
>   [9,4] = -1.2300
>   [10,4] = -2.5000
>   [11,4] = -3.8500
>   [12,4] = -2.6700
>   [13,4] =  13.700
>   [14,4] =  3.6100
>   [15,4] =  1.1600
>   [16,4] = -6.9000
>   [17,4] =  4.9400
>   [18,4] = 0
>   [19,4] =  4.7100
>   [20,4] = -2.2500
>   [21,4] = -1.1500
>   [22,4] = -8.1400
>   [23,4] =  2.5300
>   [24,4] =  7.4100
>   [25,4] =  6.9000
>   [26,4] =  8.6000
>   [27,4] =  4.9500
>   [28,4] = -2.8300
>   [29,4] =  2.9100
>   [30,4] = -1.8900
>   [31,4] =  5.7700
>   [32,4] = -2.7300
>   [33,4] = -3.7400
>   [34,4] = -1.9400
>   [35,4] =  0.99000
>   [36,4] = -1.9600
>   [37,4] =  6
>   [38,4] =  8.4900
>   [39,4] =  5.2200
>   [40,4] = -4.9600
>   [41,4] = -6.0900
>   [42,4] =  10.190
>   [43,4] = -3.3600
>   [44,4] = -3.4800
>   [45,4] = 0
>   [46,4] =  5.4100
>   [47,4] = -17.090
>   [48,4] = -5.1500
>   [49,4] =  4.3500
> }
> 
> >>> a = r.Value;  // Data from excel correctly returned, but still can't
> >>> assign to variable
> >>>error: can't perform indexing operations for octave_com_object type
> 

I am running out of ideas now, since I cannot reproduce your problem. If 
access to xls files is all you want with the windows package there is an 
additional possibility which you should check, maybe it works for you.

The xlsopen and so on commands can also work without the windows package and 
can use the java package instead.

Can you try if the following works for you (at least it would be a workaround 
for reading excel sheets  if that works for you)

pkg load java # only needed if you do not automatically load java on start

xls = xlsopen("C:\\mappe1.xls", 0, "POI") # replace with your filename
Java/Apache POI interface requested...  Java/Apache (POI) OK. (& OOXML OK)
xls =
{
  xtype = POI
  app =

<Java object: java.io.FileInputStream>

  filename = C:\mappe1.xls
  workbook =

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

  changed = 0
  limits = [](0x0)
}

a = xls2oct(xls, 1)
(Reading from worksheet Tabelle1)
a =

{
  [1,1] =  1
  [2,1] =  4
  [1,2] =  12
  [2,2] =  5
  [1,3] =  34
  [2,3] =  8
  [1,4] = abc
  [2,4] = def
}

- mh




reply via email to

[Prev in Thread] Current Thread [Next in Thread]