Code covered by the BSD License  

Highlights from
MATLAB TCP/IP - code example

4.30769
4.3 | 15 ratings Rate this file 240 Downloads (last 30 days) File Size: 1.29 KB File ID: #11802

MATLAB TCP/IP - code example

by

Steven Kolak

 

26 Jul 2006 (Updated )

MATLAB with TCP/IP - code example

| Watch this File

File Information
Description

MATLAB supports TCP/IP communication using Instrument Control Toolbox.
This MATLAB code example shows you how to exchange data with a remote application using TCP/IP. This example is taken from a MATLAB Digest technical article written by Edward J. Mayhew from George Mason University.

Learn more about using MATLAB with TCP/IP communication at:
http://www.mathworks.com/tcpip

Required Products Instrument Control Toolbox
MATLAB release MATLAB 7.2 (R2006a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (23)
12 Dec 2014 Usman Qadir

Usman Qadir

Hi i have a built in tcp server in one of my programs. I want to transmit data from my software to matlab using tcp. How can i query the server for returning the value of a specific variable ? which set of commands should i use ?

Comment only
04 Aug 2014 dfd2

dfd2

very good

Comment only
28 Jul 2014 wanbiao

wanbiao

 
13 Jun 2014 Xiaomin Zhou

Xiaomin Zhou

 
30 May 2014 SJTU

SJTU

 
30 May 2014 SJTU

SJTU

 
10 May 2014 TP

TP

 
07 May 2014 wang

wang

 
06 May 2014 wang

wang

 
12 Apr 2013 leo

leo

How to transfer a variable is a string?
example: varable data

I written: fprintf(tcpServer,data,'String')
But it show error:
Error using icinterface/fprintf (line 130)
FORMAT must be a string.

Error in tcp (line 5)
fprintf(tcpipServer,data,'String');

How can I fix it?

Comment only
19 Nov 2010 Avinash Parnandi

Avinash Parnandi

Very good program for beginners.

27 May 2010 ibrahim khalil

ibrahim khalil

I have tried to use this example too but it didn't work. Try to write your own S-Function with a Client or a Server.

Comment only
27 May 2010 Benea Catalin

Benea Catalin

Question: How can I send data from matlab simulink with instrument control toolbox tcp/ip send/receive blocks , between 2 computers. What do I need to configure actually receive something on the remote computer

Comment only
25 Nov 2009 Anuradha

Anuradha

Can somebody pls let me know whether this "Instrumentation tool box" or "tcpip" function in MAtlab can be ued to read data received by the ethernet port?

Thank you.
Anuradha

Comment only
22 Apr 2009 Ricardo Correia

Ricardo Correia

Hello! Can i transfer data on matlab, from one session to other?
Is it possible with this code? I want to transfer a wav file from a server to a client (on matlab).
Thanks for your help.
Ricardo

Comment only
18 Mar 2009 Christian

Christian

Hi,

has anyone an example which communicates with the Visual Studio (c#, Vb.Net,...)?

20 Jul 2008 ibrahim adnan

wonderfullllllllllllllllll

28 Jan 2008 Gundi Can

Hi,

I build a socket communication with Matlab and VS2003. My question is, if I send data from VS (server) to Matlab-Client, the fscanf operation needs a lot of time. I have to terminate the server programm. In Matlab Command window prompts the warning:Warning: A timeout occurred before the Terminator was reached.
Error in ==> icinterface.fscanf at 196
out = fscanf(igetfield(obj, 'jobject'), totalSize);

Error in ==> scope_mod at 33
rcvData = fscanf(t);

Does somebody have any suggestion?

Thanks a lot!

Comment only
27 Oct 2007 savita sheoran  
24 Feb 2007 Filipe Ieda Fazanaro  
05 Dec 2006 Nhan Nguyen  
14 Sep 2006 Hideaki Okazaki  
29 Jul 2006 Bill O'Shea

This is a "starter" example, but it does show you how to easily transfer data with MATLAB using TCP/IP.

Updates
07 Aug 2006

Updated description

21 Aug 2006

Updated description

24 Mar 2014

Minor file updates

Contact us