Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: check serial ports via matlab
Date: Tue, 27 Oct 2009 10:34:12 -0400
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <hc70d4$82b$1@fred.mathworks.com>
References: <hc6r8b$qie$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: jarvit.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1256654052 8267 172.31.56.68 (27 Oct 2009 14:34:12 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 27 Oct 2009 14:34:12 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:580370



"jacob lalaounis" <lalaounisjacob@gmail.com> wrote in message 
news:hc6r8b$qie$1@fred.mathworks.com...
> Hello,
>
> I would like to send data from a serial port to another serial port.
> I would like to check this by sending data and check what i get through 
> matlab.
> How is this possible??

Hi Jacob,

The basics are as follows:

s=serial('com1','BaudRate', 9600 );
inspect(s);
fopen(s);
if( s.BytesAvailable > 0 )
    data = fread( s, s.BytesAvailable );
end
fwrite(s,'Hello World!');
fclose(s);
delete(s);
clear s;

The following link provides documentation for using serial ports in MATLAB.

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f38496.html