01-03-2013 06:05 PM
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
Solved! Go to Solution.
01-04-2013 05:56 AM
01-04-2013 10:46 AM
I need to be able to enable it programatically.
01-04-2013 11:26 AM
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!
01-04-2013 11:32 AM
@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...
01-04-2013 11:41 AM
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.
01-04-2013 11:45 AM
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
01-04-2013 12:10 PM
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.