Integrating UE and Matlab

Integrating UE and Matlab

2
NewbieNewbie
2

    Mar 30, 2009#1

    I'd like to call Matlab from UE 14.20 using Matlab as an automation server, basically as in the example below. However I'm getting an error with the "new ActiveXObject" line.

    Is it possible at all? If not any ideas how to do it?

    Code: Select all

    function callMatlab(sCommandStr) {
    	var MatLab = new ActiveXObject("matlab.application");
    	
    	MatLab.Execute (sCommandStr)
    	
    }
    
    var sCommandStr = ""
    
    if (UltraEdit.document[1].isSel()){
    	
    	sCommandStr = UltraEdit.activeDocument.selection;
    	callMatlab(sCommandStr);
    
    }
    
    Best Regards
    Max

    6,604548
    Grand MasterGrand Master
    6,604548

      Mar 30, 2009#2

      The script feature of UltraEdit uses the core engine of JavaScript. Creating an ActiveX object is not supported by the core engine of JavaScript. You need to write a Visual Basic script (*.vbs) which you can run from within UltraEdit via a user tool. I don't have MatLab nor any knowledge how to write Visual Basic scripts. So I can't help you further than that the command line for the user tool should be something like:

      C:\Windows\System32\wscript.exe "name of your VB script with full path" "%sel%"

      %sel% is replaced by UltraEdit on launch of the user tool with the selected text which of course can't be a multi-line string.

      See also Invoke COM objects from a javascript?
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Mar 31, 2009#3

        Mofi,

        Thanks for the answer and the link I didn't find that when searching the forum.

        Actually I thought of using a user tool, using a temporary file for in- and output, however that's not so very elegant. Anyway that is apparently the way to do it as I will have multi-line statements to pass so the %sel% won't work.

        For anyone interested I'll post my solution here, when/if I get it working.

        Thnx again
        -Max