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

Re: [sc-users] Arrays and class



anArray.as(FloatArray)

Actually, the arrays can be any kind of raw array. Which raw array class you use depends on the C data type you want to write (the sc number class doesn't matter as much):

FloatArray -- 32-bit floats
DoubleArray -- 64-bit floats
Int8Array -- 8-bit integers
Int16Array -- 16-bit integers
Int32Array -- 32-bit integers

hjh

On Dec 28, 2008, at 9:01 PM, koonce@xxxxxxxxxxxxx wrote:

When writing arrays of numbers to a binary file, the arrays need to be FloatArrays, as in:

f = File( "test", "wb");

f.write( FloatArray[1.0, 2.0 ] ) ;

If you had something like

IntegerArray[ 1, 2 ] or Array[ 1.1, 2.1 ]

and you needed to change, not the values but, the array class to FloatArray for printing, how would you do it short of simply creating a FloatArray copy of the array?



: H. James Harkins
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman