How to set the "usecanvas" error in Scilab on Linux Ubuntu laptops...
The problem:
We sometimes use a system on which the graphics drivers cannot be used by Scilab. This happens for example on some Linux Ubuntu systems, especially on laptops.
The solution:
In order to avoid this, we can configure the .scilab startup file and turn off the canvas by typing: usecanvas(%f)
The problem is that turning the canvas off with the usecanvas function also displays the message.
In order to workaround this problem we may use the following trick:
First, let's open the .scilab startup file with the following statement: editor(fullfile(SCIHOME,".scilab"))
Then paste the following source code:
// Turn usecanvas ON without displaying anything in the console
// Copyright (C) 2011 - DIGITEO - Clément David.
// Copyright (C) 2011 - DIGITEO - Michael Baudin
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
function turnCanvasOff()
m = getscilabmode();
if (m=="STD"|m=="NW") then
previousDisp = disp;
prot = funcprot();
funcprot(0);
deff("disp(str)", "");
usecanvas(%f);
disp = previousDisp;
funcprot(prot);
end
endfunction
turnCanvasOff();
clear turnCanvasOff;
The trick used in this function is to locally redefine the disp function, so that the warning message is not displayed at all.