LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to prevent Matlab from starting with LabVIEW

Solved!
Go to solution

I have some Matlab scripts in my vi and when it loads the Matlab opens.

I do not use it most of the time (it is there for prototyping) so I was wondering if there is a programable switch which will let Matlab load or not with the start of the vi?

 

thanks

0 Kudos
Message 1 of 8
(2,950 Views)

Maybe putting your Matlab scripts in a Diagram Disable structure?

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 8
(2,931 Views)

I need to be able to enable it programatically.

0 Kudos
Message 3 of 8
(2,914 Views)
Solution
Accepted by topic author pawel

Hello pawel,

 

You could try using the Conditional Disable Structure.  See its help file here.  However, I don't think any of its default conditions will be particularly useful for you.

 

It would also be simple to place the offending code into a Case Structure controlled by a simple Boolean button on your front panel.  If you want the code to execute, set the Boolean true.  If not, set it false, and leave the false part of the structure empty.  That should take care of it.  Good luck with your coding!

Patrick
CLA
0 Kudos
Message 4 of 8
(2,908 Views)

@PatJamSim wrote:

Hello pawel,

 

You could try using the Conditional Disable Structure.  See its help file here.  However, I don't think any of its default conditions will be particularly useful for you.

 

It would also be simple to place the offending code into a Case Structure controlled by a simple Boolean button on your front panel.  If you want the code to execute, set the Boolean true.  If not, set it false, and leave the false part of the structure empty.  That should take care of it.  Good luck with your coding!


The only caveat here is that you must be prepared for a significant pause in the VI while Matlab spins up...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 8
(2,900 Views)

Hey Bill,

 

I agree that launching MATLAB during execution could create the significant pause you are referring to.  I was under the impression that the original poster would either enable or disable the MATLAB script before running the VI, and thus the expected delay for launch would occur immediately and would hopefully not overly affect his VI's execution.  At least they could prevent the delay when not using the script at all.  In either case, it is certainly something to take into consideration.

Patrick
CLA
0 Kudos
Message 6 of 8
(2,897 Views)

The conditional disable structure should work. I can define symbols and use them to enable the Matlab scripts. When disabled the Matlab should not start when I load vi.

 

The normal conditioanl loop will prevent execution of the script but the Matlab will still start.

 

thanks

Message 7 of 8
(2,894 Views)

Hello pawel,

 

I played around with a standard Case Structure, and it turns out I was a little off with my previous statement.  LabVIEW will optimize VIs by excluding unreachable code, but by placing a Boolean control as the case selector, both cases are technically reachable.  If you place a Boolean constant as the input to the structure, then LabVIEW will optimize out the case that cannot execute.  However, this method won't allow programmatic access since you have to dive into the block diagram to change execution.  I'm glad you found a way to get the Conditional Disable to work, and I apologize for the somewhat erroneous instruction.

Patrick
CLA
0 Kudos
Message 8 of 8
(2,887 Views)