Scilab is a wonderful piece of software to use. It’s powerful, stable, a free alternative to Matlab, and it’s cross platform – happily crunching away matrices on Windows, OS X, and Linux. However the old problem persists of MS Windows using backslashes ‘\’ when OS X, Linux, and Internet URLs use slashes ‘/’. Slashes are great as they are easier to type on a US keyboard. If you are doing any kind of file IO with Scilab you must be careful when using slashes in your code if you expect your code to go cross platform. The handy boolean MSDOS variable can be used early to prevent problems.
slashchar = '/'; //Mac/Linux slash if MSDOS then slashchar = '\'; //Windows
An additional interesting tidbit regarding slashes and file paths in Scilab is that mopen will happily open a file path such as:
But when you ask mclose to close the same file path it gives an error. Sadly this error is not enough to stop program execution, nor can you capture the error in a try/catch/end statement. An invalid path and filename when closed with mclose will return
0 just as when it successfully closes a file. I guess Scilab still has a little more work to do but overall it’s a great scripting language to use to quickly crunch numbers or code in.