Hi,
I am trying to read a binary file by doing the following:

read(fid, DataType[i], Numelements[i]).

I would like to extract DataType from a user input which is read from a 
column (whose header is 'type') of DataTable which is a string array.
For example 
DataTable[1,:type] = "uint8"
DataTable[2,:type] = "sint16"
..etc
I would like to convert this "uint8" to UInt8 in that same column but I 
could not figure how and so I generated a new cell array' T' of that size.
And then with an if statement I occupy the new variable with DataType. Ugh!!

An example for an arbitrary kth row of the DataTable column...

i.e., if DataTable[k,:type] == "int16"
        T[k]=Type[Int16];
      end

when I actually run it I get the following error...

julia> T[1]
1-element Array{DataType,1}:
Int16

julia>read(fid, T[1] ,keyNumElem[1])

ERROR: MethodError: `read` has no method matching read(::IOStream, 
::Array{Type{T},1}, ::Int32)
Closest candidates are:
  read{T}(::IO, ::Type{T}, ::Int32, ::Int32...)
  read{T}(::IO, ::Type{T}, ::Integer, ::Integer...)
  read{T<:Base.AbstractPipe}(::T<:Base.AbstractPipe, ::Any...)
  ...


I understand the problem but do not know how to convert a string to 
..."what?" I mean what is the 'type' of the 2nd parameter in read 
-'Type{T}'? Is it a string?
Or maybe I am correct and I have to convert Array to an element? How do I 
do that?
Very confused!!
Thanks

Reply via email to