How to Delete/Clear Variables

Dec 19, 2011 at 1:08 PM

My real goal is to change the data of a variable to a shorter dimension.  So for example, I want to do the following....

        Dim ds As sds.DataSet = sds.DataSet.Open("someURI")
        Dim var As String = "variable1"
        ds.AddVariable(Of Double)(var)
        Dim data1 As Double() = {1, 2, 3, 4, 5}
        Dim data2 As Double() = {6, 7}

        'now I want to change the variable to data2
        ds.Variables(var).PutData(data2) 'this doesn't work becuase the new data set is shorter, I end up with: 6,7,3,4,5


I figured I could delete or clear the variable and then re-add it to achieve this goal, but the clear() method is not supported.  Any recommendations?