03-28-2010 03:57 PM
Hi,
I had a basic question on integrating a matlab m file into labview. What I pretty much want is the ability to run a certain m file at a flip of a switch.
I essentially created a reset button and that reset button will reset my device.
I attached my block diagram to my best guess to how it would work but when I tried to run it, it does not run the m file.
Any reason why? I tried while(y==1) and if(y==1) to run it but doesn't seem to work.
Thanks! Looking forward to hearing from you!
Justin
03-28-2010 04:06 PM
Do you have a while loop wrapped around this? Otherwise it only runs once.
It would make more sense to have the mathscript node in the True case of a case structure.
I don't know enough about mathscript to know whether a boolean can be compared to 1 for equality, or if it would be -1, or must be a True, False constant. Why not do a While (y) ?
Also, assuming things do work, your Mathscript node would never end. Because you have a while y==1 loop. Once it is true, it will always be true. Y can only change if you ever exit the mathscript node and allow the boolean control to be read again.
03-28-2010 04:07 PM
Did you put MathScript inside of a loop?
The example attached seems to work pretty well.
03-28-2010 04:10 PM
I can take the while statement out. I just want to figure out how to literally run the program at a flip of a switch on labview because I like the GUI of labview and finding it difficult to do so.
like [Press Button] => [Run Script] => [End]
It works just fine on matlab.
Justin
03-28-2010 04:11 PM
03-28-2010 04:17 PM - edited 03-28-2010 04:19 PM
Just remember to put Wait statements in the loops so they don't run the CPU at top speed.
03-28-2010 04:33 PM
thanks for the help.
the code you gave me seems to work in a sense in activating the switch but now I have another problem. This code is suppose to output a voltage out of the DAQ-6009 but its not.
When I run the program via matlab it works just fine. But when I run it in labview it doesn't work. I notice that most examples on thelabview websites arefor basic calculations. In terms of putting things in like analoginput, analogoutput, putsample and all that to call the USB-6009 daq device from matlab. Is that possible to do all of that in mathscript in labview? Or would I need to make a virtual channel and call it from there?
I'm sorry if it seems like a confusing question.
Thanks
Justin
03-28-2010 05:27 PM
03-28-2010 06:48 PM
I never really had formal teaching in labview, I"m trying to learn labview but it has a pretty steep learning curve. Since i'm a student I only learned how to program in standard C and java so the logic in matlab makes sense to me.
but the thing is I really like the GUI that labview and thought it might be useful in my application so I thought I'd integrate the two but its proving more difficult then I originally thought
03-28-2010 07:00 PM