Filter löschen
Filter löschen

How to send Table using UDP in MATLAB

2 Ansichten (letzte 30 Tage)
Med Future
Med Future am 3 Mär. 2024
Kommentiert: Image Analyst am 4 Mär. 2024
Hello, I hope you are doing well. I want to send Table using UDP. How can i do that?
I have write the following code but it does not working. Can anyone help me with that
client_port = 10011;
clientAddress = '192.168.100.202';
% Define the table
C = {5 "cereal" 110 "C+"; 12 "pizza" 140 "B";...
23 "salmon" 367 "A"; 2 "cookies" 160 "D"};
T = cell2table(C, 'VariableNames', {'Age', 'FavoriteFood', 'Calories', 'NutritionGrade'});
% Open a UDP port
u2 = udpport("IPV4",'LocalPort',client_port);
% Send the data
write(u2, clientAddress, client_port, T);
  1 Kommentar
Image Analyst
Image Analyst am 4 Mär. 2024
Save yourself some work and add only tags that are actually related to your question, not 22 unrelated (like image processing) or useless tags such as matlab, matlab code, code, etc.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Voss
Voss am 3 Mär. 2024
According to the documentation, the "data" input is:
"Vector of values to write, specified as a row (1-by-N) or column (N-by-1) array of numeric data, string, or character vector."
A table is none of those things.
Also, the order of the inputs is:
"write(u,data,destinationAddress,destinationPort)"
or
"write(u,data,datatype,destinationAddress,destinationPort)"
  7 Kommentare
Med Future
Med Future am 4 Mär. 2024
@Voss how Can i read this table on recieving side?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Licensing on Cloud Platforms finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by