![scilab output matrix scilab output matrix](https://help.scilab.org/docs/6.1.0/ja_JP/MATRESH_gui.gif)
It can create x-y plots with the plot function, contour plots with the contour function, 3D plots with the surf function, histograms with the histplot function and many other types of plots. Scilab can produce many types of 2D and 3D plots. We finally export the plots so that we can use it in a report. Then we customize the title and the legend of our graphics.
#Scilab output matrix how to
In this section, we present how to create 2D plots and contour plots. Scilab offers many ways to create and customize various types of plots and charts. Again we make sure to use \t and \n escape sequences to position the cursor in the right place before displaying the temperature value.Īfter running the script we get the following output in the Scilab console.įor any questions, observations and queries regarding this article, use the comment form below.Producing plots and graphics is a very common task for analysing data and creating reports. With the instruction length(T_degC) we calculate the number of values contained in the temperature vector.Īt each iteration of the for loop, we display a line in the Scilab console. 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.
![scilab output matrix scilab output matrix](https://help.scilab.org/docs/6.0.2/ja_JP/CMATVIEW_gui.gif)
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")
![scilab output matrix scilab output matrix](https://help.scilab.org/docs/6.0.1/en_US/CMAT3D_gui.gif)
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.
![scilab output matrix scilab output matrix](https://i.stack.imgur.com/pq8yC.png)
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. Scilab is very powerful and versatile when working with data, especially in matrix format.