Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use MATLAB to send signals to a port of an IP address?

How to use MATLAB to send signals to a port of an IP address?

The fact is that I have connected a robot car with PC by Wifi and I've decided that the signal FF000400FF received by the robot will drive the car forward. I tested this by TCP&UDP tools and it was OK. So I think it should have been OK using MATLAB to send this signal, too.

my code is:

t = tcpip('192.168.1.1',2001);
fopen(t);
a=dec2hex(1095216922879);  %FF000400FF(H)
fprintf(t,a)

but it doesn't work. I've been working on this for long but failed.

like image 473
Yancy Avatar asked Dec 14 '15 12:12

Yancy


People also ask

How do I connect to a server in Matlab?

Open the TCP/IP Explorer app from either the Apps tab in the MATLAB toolstrip or the MATLAB command prompt. Click Configure TCP/IP Connection. Specify Address as the server address and Port as the server port to connect to the server.

Can communication using Matlab?

Hardware connection functions define a connection to a CAN interface hardware that establishes a physical connection to a CAN bus. The CAN Transmit Workflow shows how to pack and transmit CAN messages with MATLAB®. You can also employ event-based message transmission; load and replay messages.


1 Answers

try this one:

fwrite(t, [255, 0, 4, 0, 255])
like image 135
user5678677 Avatar answered Nov 04 '22 09:11

user5678677