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!
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!