I want to send unsigned short vector in visual c++ to matlab using socket communication.
I have an unsigned short vector std::vector test that has
//test[0]-test[3] short values comverted from longlong (64bits/16bits=4 elements)
//test[4]- short values.
Now I want to socket this vector to matlab.
In VC++,
send(socket, (char *) &test[0], test.size()* sizeof(unsigned short), 0);
In matlab m-file, I tried
//t=tcpip(----);
//fread(t, 4, 'uint64');
//fread(t, the rest of bytes, 'ushort');
but values I got on matlab looks wrong.
"fread(t, 4, 'uint64')" shows invalid precision and
"uint64(fread(t,4,'uint64'))" does also the same error.
How can we receive and convert data on matlab?
Thanks in advance!