[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: send octave output to string
From: |
Ben Abbott |
Subject: |
Re: send octave output to string |
Date: |
Sun, 07 Sep 2008 19:38:16 -0400 |
On Sep 7, 2008, at 7:17 PM, Bill Denney wrote:
charles reid wrote:
Hi there -
I've been searching Octave documentation & the web with no luck on
this, so I thought I would ask here. If I want to send the output of
an Octave command to a string, how would I do that? For example,
if I
type
a = 2 + 2
And I want a string to contain the resulting " a = 4 ", how would I
do
that? Thanks!
You're looking for num2str or sprintf:
num2str(a)
or
spritnf("%d", a)
Have a good day,
Bill
If you want the "a =" part as well.
str = sprintf ("a = %d", a);
Or do you want to capture the output to the console for a specific
command?
I dont' know how to do that, anyone else?
Ben