- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Apologies if this has been posted before - but I had a look and could not find it.
I have AUTODICE running ok on IVF XE 2011 - but I'm trying to read a 2d range of data into a fortran array from an excel sheet.
In VB syntax this would be simple :
Dim gen_array(0 To maxrow, 0 To maxcol) As Object
.
.
With objSheet
gen_array = .Range(.Cells(nStartRow, nStartCol), .Cells(nStartRow + nrows - 1, ncols)).Value
End With
is there a relatively easy way to do this in Fortran ?
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Looking at the notes in some of my own code, my understanding is you can write a row eg. B5:Z5 or a column D5:D22 but not a block of data. Thus I have a loop of writes to write a block. i can prob post some sample code later.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
It would be greatly appreciated if you could post some code. I have often wanted to do this also, and have seen several discussions in this forum from years back, but none of them were very simple.
Both reading and writing are of interest.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I gave up trying and put the extraction routine into a loop for each cell..
Here's the code for future reference in the hope that someone can do better.
! assign the range to the array k0=0 do j=jrow1, jrow2 k0=k0+1 k1=0 do i=jcol1, jcol2 k1=k1+1 call conv_2_col(i,col1) call trim_blank(col1,ib0) call gen_conv_text_int(row1,j) call trim_blank(row1,ib2) cell1add=col1(1:ib0)//row1(1:ib2) ! specify the input range (singel cell in this case - since I can only re-assign one at a time..) CALL VariantInit(vBSTR1) vBSTR1%VT = VT_BSTR bstr1 = ConvertStringToBSTR(cell1add) vBSTR1%VU%PTR_VAL = bstr1 range = $Worksheet_GetRange(worksheet, vBSTR1, vBSTR1, status) CALL Check_Status(status, " Unable to get RANGE object") status = VariantClear(vBSTR1) bstr1 = 0 ! get the single cell from excel and store it in the character array status = AUTOGETPROPERTY (range, "VALUE", gen_array(k0,k1)) end do end do
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla