Oftentimes you would like to extract data points from the plots as this is extremely useful to do so especially in Engineering and Science analysis. This is especially the case when we are manipulating plot data using some editing method. A similar application MATLAB has a function that allows synchronising of what is being shown in the plotting window to what is stored in the variables. But this function is buggy and can oftentimes CORRUPT the original data stored as unique variables for later processing. Also, it is a good practice not to modify the original variables for comparing with the plot data later. In Scilab, it is really simple to extract information about what is being shown in the plot window as Scilab stores everything in the plot as different object variables which are easily accessible from the Scilab console command prompt. Just with the help of few statements in the command prompt we can easily dump the plot data into the console and copy them over to a spreadsheet or any other editor for saving the plot data separately. Let's assume we have plotted some variables Scilab and the plot window show up. Once the plot window shows up and shows the data we can enter the following commands to dump the plot data into the console:
h = gca()
p = h.children
c = p.children
c.data
The first command as shown above retrieve and stores a reference to the graphics object which is holding the plot. The subsequent commands get handles of objects residing in the graphics object. The final command dumps the plot data into the console using the handle which points to the plot data object variable. The following figure shows the result where variable y data what plotted and the above commands dumped the plot data into the console:
Imam