Thread Subject: string to control instrument

Subject: string to control instrument

From: Daphne

Date: 13 Jan, 2008 20:33:01

Message: 1 of 2


I am trying to control an serial instrument through Matlab
and one of the functions calls for a:
fprintf(1,'1LMP 40')
where the 40 is a value that I set the instrument to. Now
if I am reading the value from a GUI and want to use
['1LMP ', num2str(val)] this errors out.
Also, if I try to create the correct string before hand (a
= ''1LMP 40''; and then use it, it errors out.

Any ideas how to 'feed' the info into this command?

Thanks,
Daphne

Subject: string to control instrument

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 14 Jan, 2008 00:25:13

Message: 2 of 2

In article <fmdsht$hdr$1@fred.mathworks.com>,
Daphne <daphnew_too_nospam@yahoo.com> wrote:

>I am trying to control an serial instrument through Matlab
>and one of the functions calls for a:
>fprintf(1,'1LMP 40')
>where the 40 is a value that I set the instrument to. Now
>if I am reading the value from a GUI and want to use
>['1LMP ', num2str(val)] this errors out.
>Also, if I try to create the correct string before hand (a
>= ''1LMP 40''; and then use it, it errors out.

>Any ideas how to 'feed' the info into this command?

"this errors out" and "it errors out" are not specific enough
for us to figure out what issues you are facing.

If you have fetch val from a GUI, then val would probably be
a string rather than a numeric value. Perhaps num2str(val) is
leading to an error because val is already a string? If so then

['1LMP ' val] would form the string you need.


The code you give,
a = ''1LMP 40'';
uses incorrect syntax for a string.
a = '1LMP 40';

--
We regret to announce that sub-millibarn resolution bio-hyperdimensional
plasmatic space polyimaging has been delayed until the release
of Windows Vista SP2.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
serial instrument command Daphne 13 Jan, 2008 15:35:03
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com