large amount of data, so I'm trying to do it through a binary file. I have

a script to read the data into a matlab matrix, from matlab I construct a

binary file, and then I am trying to read it into go.

I can successfully read in the first 492 doubles using bufio.Read, but for

some reason the 492nd element only reads 6 bytes rather than the full

eight. I would like some help debugging this.

The relevant Matlab code is the following:

outVarnames = {'reynolds_stress_uu_xyz','reynolds_stress_vv_xyz',...

'reynolds_stress_uv_xyz', 'dx_mean_u_xyz', 'dy_mean_u_xyz',

'dx_mean_v_xyz',...

'dy_mean_v_xyz'};

% Save data in a binary format

fid = fopen('DNSData.bin','w');

fwrite(fid,'x_loc ');

fwrite(fid,'y_loc ');

for ii = 1:length(outVarnames)

fwrite(fid,outVarnames{ii});

fwrite(fid,' ');

end

fprintf(fid,'\n')

fwrite(fid, 1.0,'double',0,'l');

fwrite(fid, 17.3,'double',0,'l');

fwrite(fid, 5*10^60,'double',0,'l');

xLocs(1,100)

% % Print grid locations

for ii = 1:500

xLocs(ii)

fwrite(fid,xLocs(ii),'double',0,'l');

end

fclose(fid);

and the full Go script I am using can be found

http://play.golang.org/p/UJYPwmN5X6

If I run the Matlab loop from 490 to 500 (instead of 1 to 500), I can

successfully read in all of the elements, but if I run the loop from 490 to

1000, somewhere around the 490th entry again only 6 bytes are read rather

than 8. Does anyone have any ideas on why this would happen? If it's

possibly relevant, the xLocs variable is a matlab matrix that is 2304 by

385.

Thanks for your help, I'm stumped.

Brendan

--

You received this message because you are subscribed to the Google Groups "golang-nuts" group.

To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.