[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Input command

From: Richardson, Anthony
Subject: RE: Input command
Date: Thu, 6 Dec 2012 16:33:33 +0000

Original Message-----
On Behalf Of Gaftave

> Hi,
> I'm not a very expert user and I was wondering if it is possible to write more
> than one input command in order to make Octave ask for every value. In fact
> I was trying with something like this:
> a=input('enter the a value')
> b=input('enter the b value')
> ... and so on,
> but i did'nt work.
> Can you suggest something?
> Thank you for being so helpful.
> G

It is not pretty, but I think this does what you want.

in = input("Enter a and b: ","s"); [ a b ] = sscanf(in, " %f %f","C");

It works by reading the entire input line is as text and then using sscanf to 
parse the line.
Unfortunately, you can't use scanf to parse input directly from stdin while in
interactive mode.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]