Wednesday, December 24, 2014

Keyboard input in running time

MERRY CHRISTMAS!

Dear readers, I hope you have a merry Christmas and a great new year!

This is my last post in 2014, thus I'd like to say THANK YOU, for all my readers, this blog has been much visited and became a relevant reference for Scilab.

This blog is the concretization of my will to share some knowledge about Scilab, and it's now a reference for people around the World.

But, coming to the technical content, let's see something about using keyboard for input data in running time.

Scilab has the function input(), that holds the script execution and returns anything is typed in the keyboard.

Try this line in the Scilab console:

-->x = input("x will be: ");
x will be: 2

-->x
 x  =

    2.

The value 2 was inserted from the keyboard, you can try any value and after use the variable x in following commands.

If you want to input a string, there are two ways:

single or double quotes when typing:

-->x = input("x will be: ");
x will be: 'hi'

-->x
 x  =

 hi  

-->x = input("x will be: ");
x will be: "hello"

-->x
 x  =

 hello  


Or, you can use a second argument "string":

-->x = input("x will be: ", "string");
x will be: yes!

-->x
 x  =

 yes!


If you try to type text without single or double quotes, there will happen an error:

-->x = input("x will be: ");
x will be: test
Undefined variable: test
x will be: 0


So, it's all!

Let's stay using, studying and improving Scilab in 2015!

2 comments:

Anonymous said...

I want to read double data using input command. Can you help in this sir

Blogger said...

This way my colleague Wesley Virgin's adventure launches with this SHOCKING and controversial VIDEO.

You see, Wesley was in the military-and soon after leaving-he revealed hidden, "self mind control" secrets that the government and others used to obtain everything they want.

As it turns out, these are the same tactics tons of celebrities (especially those who "come out of nowhere") and the greatest business people used to become wealthy and famous.

You've heard that you use only 10% of your brain.

Really, that's because most of your brainpower is UNCONSCIOUS.

Perhaps that conversation has even taken place IN YOUR own head... as it did in my good friend Wesley Virgin's head around seven years ago, while driving an unregistered, garbage bucket of a vehicle without a license and in his bank account.

"I'm very frustrated with living payroll to payroll! Why can't I become successful?"

You've been a part of those those types of conversations, isn't it so?

Your success story is going to be written. All you need is to believe in YOURSELF.

CLICK HERE TO LEARN WESLEY'S METHOD