Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Lancer scilab depuis excel

59 views
Skip to first unread message

blanc...@exameca.fr

unread,
Feb 13, 2007, 9:47:57 AM2/13/07
to
Bonjour à tous.

Peut-on lancer scilab depuis excel ?

Can scilab be launched from excel ?

Merci / Thanks


Fred

Anthony

unread,
Feb 14, 2007, 4:23:58 AM2/14/07
to
blanc...@exameca.fr le 13.02.2007 15:47:

> Bonjour à tous.
>
> Peut-on lancer scilab depuis excel ?
>
> Can scilab be launched from excel ?
>

yes

blanc...@exameca.fr

unread,
Feb 14, 2007, 6:29:47 AM2/14/07
to
On Feb 14, 10:23 am, Anthony <anthony@fake_adresse.fr> wrote:
> blanchar...@exameca.fr le 13.02.2007 15:47:

That would be a good thing.

I have calculations to make with excel that take too much times ( more
than 10 s ). So I have made a .sce file and want excel to launch the
script.

How can it be done ?
Can you explain it to me or give me an example ?

Thank you for all.

Fred

blanc...@exameca.fr

unread,
Feb 14, 2007, 10:25:47 AM2/14/07
to
Hello.

I have tryied to launch scilab with that VBA code :

Sub lance_programme()
monprogramme = "C:\Program Files\scilab-4.1\bin\WScilex.exe "
Shell monprogramme
End Sub

It works. But how can i launch a .sce file ?

Fred

Stephane Mottelet

unread,
Feb 14, 2007, 10:53:52 AM2/14/07
to
blanc...@exameca.fr a écrit :

try

Sub lance_programme()
monprogramme = "C:\Program Files\scilab-4.1\bin\WScilex.exe -f machin.sce"
Shell monprogramme
End Sub

or

Sub lance_programme()
monprogramme = "C:\Program Files\scilab-4.1\bin\WScilex.exe "

Shell monprogramme -f machin.sce
End Sub

S.

blanc...@exameca.fr

unread,
Feb 14, 2007, 11:35:22 AM2/14/07
to
I tried :

monscript = "C:\Program Files\scilab-4.1\bin\WScilex.exe -X C:
\derive.sce"


but scilab answers :

Startup execution:
loading initial environment
Warning !!!
Scilab has found a critical error (EXCEPTION_ACCESS_VIOLATION).
Scilab may become unstable.

And scilab don't begin the execution of the sce file..

Fred

Stephane Mottelet

unread,
Feb 14, 2007, 12:15:30 PM2/14/07
to
blanc...@exameca.fr a écrit :

it's -f not -X

blanc...@exameca.fr

unread,
Feb 15, 2007, 2:22:54 AM2/15/07
to
Hello.

I put -X because it is what is in the shortsut of a sce file in my
test folder.

Whit -f, that doesn't work neither. See below the scilab 's answer :
-----------------------------------------------------------------------------------------------------------------------------
___________________________________________
scilab-4.1

Copyright (c) 1989-2006
Consortium Scilab (INRIA, ENPC)
___________________________________________


Startup execution:
loading initial environment

!--error 276
Missing operator, comma, or semicolon

-----------------------------------------------------------------------------------------------------------------------------


Stephane Mottelet

unread,
Feb 15, 2007, 3:57:33 AM2/15/07
to
blanc...@exameca.fr a écrit :

I don't know how Excel passes arguments to scripts, it seems
to be the problem here.

S.

blanc...@exameca.fr

unread,
Feb 15, 2007, 4:09:42 AM2/15/07
to
On Feb 15, 9:57 am, Stephane Mottelet <motte...@nospam.gnark.gnark>
wrote:
> blanchar...@exameca.fr a écrit :

I agree with you and I am trying to look in that direction to solve my
problem.

arf_...@yahoo.com

unread,
Feb 21, 2007, 3:15:46 AM2/21/07
to

this may help

open excel and populate cells a1 to c3 with data

use dde poke command to pass data to excel

i'll mess with it some more and try to pass a matrix to excel in one
chunk

http://wiki.tcl.tk/996 for more info

the commands that DDE passes to excel are excel macros
i think that they are the old excel 4.0 macros

--------------------------------------------------------------------------------------------------------------------
mode(-1);
TCL_EvalStr("package require dde");

// get a list of DDE services offered by excel

TCL_EvalStr("set a [dde services Excel """"] ");
b = TCL_GetVar("a");
mprintf(b);

// retrieve a1:c3

TCL_EvalStr("set a [dde request Excel {[Book1]Sheet1}
""R1C1:R3C3""] ");
b = TCL_GetVar("a");
mprintf(b);

// retrieve a1:c3 again

TCL_EvalStr("set a [dde request Excel Sheet1 ""R1C1:R3C3""] ");
b = TCL_GetVar("a");
mprintf(b);

// see this link about DDE

// http://wiki.tcl.tk/996

--------------------------------------------------------------------------------------------------------------------

js:)

arf_...@yahoo.com

unread,
Feb 21, 2007, 5:59:56 AM2/21/07
to

hi, me again

here is a working snippet

fill some data into range A1:C3

//
--------------------------------------------------------------------------------------------------------------------

mode(-1);

TCL_EvalStr("package require dde");

TCL_EvalStr("set x [dde services Excel """"] ");
b = TCL_GetVar("x");
mprintf(b);

TCL_EvalStr("set x [dde request Excel {[Book1]Sheet1}
""R1C1:R3C3""] ");
b = TCL_GetVar("x");
mprintf(b);

TCL_EvalStr("set x [dde request Excel Sheet1 R1C1:R3C3 ] ");
b = TCL_GetVar("x");
mprintf(b);

TCL_EvalStr("set x [dde poke Excel Sheet1 R6C1:R99C99 """ + b +
""" ] ");

TCL_EvalStr("set x [dde poke Excel Sheet1 R4C5 3456 ] ");

tab = ascii(9); // tab character
nl = ascii(10); // newline character (cr (ascii 13) works too)

// assemble data to put into spreadsheet / 'tabs' separate cells /
'newlines' separate rows /
data = 'this' +tab+ 'is' +tab+ 'row' +tab+ 'one' +nl+ 'this' +tab+
'is' +tab+ 'the' +tab+ 'next' +tab+ 'row';

// another way
row1 = 'this' +tab+ 'is' +tab+ 'row' +tab+ 'one' +tab+
string(1425364) +tab+ string(3847566787);
row2 = 'this' +tab+ 'is' +tab+ 'the' +tab+ 'next' +tab+ 'row';
row3 = 'another' +tab+ 'row';
data = row1 + nl + row2 + nl + row3;

// !!!!!!!!! following range fills blanks up to R20C20 !!! make
the actual size you need

a = 'set x [dde poke Excel Sheet1 R11C1:r20c20 ""' + data + '"" ]
';
TCL_EvalStr(a);

// see this link about DDE

// http://wiki.tcl.tk/996

//
--------------------------------------------------------------------------------------------------------------------

regards

js:)

Erich Neuwirth

unread,
Feb 26, 2007, 5:13:33 PM2/26/07
to Thomas Baier
Within the next 3 weeks the R(D)COM project,
which produces RExcel, an Excel addin for connecting
R (the statistics program) and Excel
will offer the same facility for Scilab.

http://rcom.univie.ac.at
has a prerelease version in the download area.


http://rcom.univie.ac.at/download/devel/RSrv250PR2.exe

Since it is prerelease,
it might be somewhat rough,
but it contains instructions and a demo for Scilab.

The facility is NOT restricted to Excel.
Scilab is accessible as COM server which means
any program which can act as a COM client can access it.
This includes all MSOffice applications and all programming languages
included in Visual Studio.

0 new messages