After looking at the code i can say it would only create new Matlab process if the earlier $ml getting "undef" in return. Also assuming a neat code (use my with new variable $ml use strict and warnings and also use win32::OLEs warning option to get more info on it etc)is causing the same --then the question comes to me how are you running the perl code. Unless you are running perl code from within Matlab how would perl be even aware of the existence of existing Matlab OLEs(correct me if i am wrong but its my understanding of OLEs). Unless you run Matlab from within perl like below,

#!/usr/bin/perl # use strict; use warnings; use Win32::OLE; use Win32::OLE::Variant; Win32::OLE->Option(Warn => 3); my $Count = Win32::OLE->EnumAllObjects(sub { my $Object = shift; my $Class = Win32::OLE->QueryObjectType($Object); printf "# Object=%s Class=%s\n", $Object, $Class; }); print "Found $Count OLE Object(s)\n";

If this generates any output then you can consider the approach you are trying. It would be easy by not bothering with OLE, import, say, a CSV file with Matlab import. I would probably start along that route: write a CSV file with the data you want in Perl, and then import it into matlab from the matlab macro.


In reply to Re: OLE can't find Matlab aready running by sanju7
in thread OLE can't find Matlab aready running by BarneySimpson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.