The display of the data is done using a for loop. At the end we add a \n escape sequence to move the cursor to the next line. We use the \t escape sequence to add a horizontal tab between columns. The following line adds the temperature unit for each of the Temperature columns: mprintf("\t\t\n") At the end we use another \n escape sequence to move the cursor at the beginning of the next line. Each escape sequence \t adds a horizontal tab between two Temperature keywords. The first escape sequence \n starts a new line to display the table header. First line contains the keyword Temperature three times: mprintf("\nTemperature\tTemperature\tTemperature \n") In our script we split the table header into two lines. Our table needs a header which describes the content of each column. For both we use the appropriate temperature conversion formulas. The variable T_degF contains all the temperature values in degrees Fahrenheit. The variable T_K contains all the temperature values in Kelvin. We could also generate this vector automatically by using the embedded Scilab function linspace(): ->linspace(-40,100,15) The vector variable T_degC contains all the values of the temperature in ☌, starting from -40 to 100, with increments of 10 ☌. We use it to be sure that we have a clean Scilab console before we display our table. The first line calls the clc() function to clear the Scilab console.
Mprintf("\nTemperature\tTemperature\tTemperature \n") The Scilab script which displays the table above in the console, using the mprintf() function is: clc To recall the formulas for temperature conversion, read the article Temperature. The table above shows the conversion of the temperature from degrees Celsius to Kelvin and degrees Fahrenheit. The embedded Scilab function mprintf() can do this easily and efficient.įor example let’s say that we need to display the table below: Temperature As a Scilab developer you might need to write a script, for a particular algorithm, which needs to display data in the Scilab console in a table format. So remember you won't be able to use them if you upgrade your Scilab to the current stable version.Scilab is very powerful and versatile when working with data, especially in matrix format.