Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

sending and receiving data in matlab by an UDP object

pckongpckong Posts: 1Member
Hi all,

I am doing school project and am getting desperate at this moment. I hope in somewhere you will be able to give me some hints, as soon as possible.

Here is what I got. I need to send data from a PC to the other, they are both running matlab. The data transmission will be done with two sets of wireless network card.

I intended to set the data transmission done in a UDP object. Before I made the attempt, an ad-hoc network has been set up, and it is tested working. Here is some useful network information,
For PC1 (host) the IP address is 192.168.0.100 (not static IP)
For PC2 (client) the IP address is 192.168.0.223 (not static IP)

I made a simple test to try sending data with matlab via port 9090, here is what I did,
In PC1, I try to write an integer array to the client port
u=udp('192.168.0.223', 9090);
fopen(u)
fwrite(u, 1:10);
fclose(u)

In PC2, I try to read the integer array from its port
u=udp('192.168.0.223', 9090);
fopen(u)
A=fread(u, 10);
fclose(u)

But no matter how I try, I cannot retrieve the data. I cannot switch to do the whole network programming in Linux as it is too late for me, and I cannot do it in winsock either as I have written a whole bunch of other programs in matlab already.

Please help.

Yours Sincerely,

Peter

Comments

Sign In or Register to comment.