I’ve very large array of data. So I try to chop it off in chunks in hope to send them faster in smaller data frame. Here’s what I’ve tried:
var data = [-0.0000149274455907288940,.0022308228071779013,-0.000840449589304626,-0.00009198358748108149,-0.00141235312912613150,.00144868600182235240,.0023528186138719320,.00050975312478840350,.0003817091346718371,-0.000051242444897070530,.0019181815441697836,-0.0004450371488928795,-0.00053559383377432820];
var f32s = new Float32Array(data),
subarrayA = f32s.subarray(0, 5),
subarrayB = f32s.subarray(5, 13);
function Float32Concat(first, second) {
var firstLength = first.length;
var result = new Float32Array(firstLength + second.length);
result.set(first);
result.set(second, firstLength);
return result;
}
var buffer = Float32Concat(subarrayA, subarrayB);
console.log(buffer); // [-0.000014927445590728894, 0.0022308228071779013, -0.000840449589304626, -0.00009198358748108149, -0.0014123531291261315, 0.0014486860018223524, 0.002352818613871932, 0.0005097531247884035, 0.0003817091346718371, -0.00005124244489707053, 0.0019181815441697836, -0.0004450371488928795, -0.0005355938337743282]
if (buffer === data) {
console.log('Yes');
} else {
console.log('No');
}
Everything seems to be working as expected, but the result wasn’t an identical data before I chop them off.
Thank you,