From: Noman on 27 Feb 2010 11:47 My transmitter code is: u1=udp('192.168.1.55', 9091,'LocalPort', 9090); set(u1, 'OutputBufferSize', 8192) set(u1, 'TimeOut', 10) fopen(u1) get(u1, 'Status') while(1) fwrite(u1, ubuffer(1,:), 'double'); %ubuffer is of size 1x1024 end fclose(u1) delete(u1) My receiver code is: u=udp('192.168.1.166', 9090, 'LocalPort', 9091, 'InputBufferSize', 8192, 'TimeOut', 10); fopen(u); while(1) [a,count]= fread(u, 1024, 'double'); end fclose(u) delete(u) My problem is that as soon as i increase the number of elements transmitted past 64, i can only receive 64 elements at receiver. Like if i transmit 1x1024 element array, at receiver i get first 64 elements only. Like at this line of code at receiver: [a,count]= fread(u, 1024, 'double'); i only get 'a' of size 64x1, although i should get 1024x1 size of 'a'. The value of count is also 64, it should be 1024. To rectify this i have to use a loop and make a 2d array at receiver like 64x16 for 1024 element transmitted array. Also i get a warning "The specified amount of data was not returned in time" after reading every 64 elements. Is there any solution to receive all elements like 1024 in one go??? like i dont have to use loop just [a,count]= fread(u, 1024, 'double'); and i get all the transmitted elements. My second problem is that i cannot transmit complex numbers using UDP. I transmit 3 complex numbers and at receiver i only get real part of these complex numbers. Any ideas????
From: cpp.matlab on 21 Mar 2010 12:35 Use real(Z) and Imag(Z). Split one complex number into two numbers and send via UDP. Best... On Feb 27, 12:47 pm, "Noman " <m.neman.sha...(a)live.com> wrote: > My transmitter code is: > > u1=udp('192.168.1.55', 9091,'LocalPort', 9090); > set(u1, 'OutputBufferSize', 8192) > set(u1, 'TimeOut', 10) > fopen(u1) > get(u1, 'Status') > while(1) > fwrite(u1, ubuffer(1,:), 'double'); %ubuffer is of size 1x1024 > end > fclose(u1) > delete(u1) > > My receiver code is: > > u=udp('192.168.1.166', 9090, 'LocalPort', 9091, 'InputBufferSize', 8192, 'TimeOut', 10); > fopen(u); > while(1) > [a,count]= fread(u, 1024, 'double'); > end > fclose(u) > delete(u) > > My problem is that as soon as i increase the number of elements transmitted past 64, i can only receive 64 elements at receiver. Like if i transmit 1x1024 element array, at receiver i get first 64 elements only. Like at this line of code at receiver: > > [a,count]= fread(u, 1024, 'double'); > > i only get 'a' of size 64x1, although i should get 1024x1 size of 'a'. The value of count is also 64, it should be 1024. > > To rectify this i have to use a loop and make a 2d array at receiver like 64x16 for 1024 element transmitted array. Also i get a warning "The specified amount of data was not returned in time" after reading every 64 elements. Is there any solution to receive all elements like 1024 in one go??? like i dont have to use loop just > [a,count]= fread(u, 1024, 'double'); > and i get all the transmitted elements. > > My second problem is that i cannot transmit complex numbers usingUDP. I transmit 3 complex numbers and at receiver i only get real part of these complex numbers. Any ideas????
|
Pages: 1 Prev: putting legend outside the plot Next: Basic Loop Question |