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?
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.
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.