LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab calculation in Labview

Once invoking Matlab for calculation, Labview 2013 will shut down automatically. Are there any problems with the code?

0 Kudos
Message 1 of 6
(3,348 Views)

I don't know if there are problems with the code, but why bother with Matlab?  This is almost trivial LabVIEW (you should be able to figure out the True case by yourself ...).  Note I'm not doing anything "fancy", just a direct implementation of what you wrote.

Matlab code.png

Bob Schor

0 Kudos
Message 2 of 6
(3,310 Views)

you mean the problem is in the formula node, but the VI can work properly in the absence of Matlab script (TDEV.vi). thank you for your kind help!

0 Kudos
Message 3 of 6
(3,292 Views)

There is probably no problem with the formula node except it is not needed here and just complicates things. The matlab script in the subVI could of course also be written in plain LabVIEW, but that would involve a little bit more work. 😉

 

It is hard to tell what the problem is but we are dealing with two different systems (LabVIEW & matlab) so there are many possibilities of failure. What is your matlab version? Is it 32 or 64bit?

 

Does the matlab script work correctly with very simple matlab code?

Does the matlab code work correctly within matlab?

 

Your matlab comments have unusual characters. Are these unicode?

0 Kudos
Message 4 of 6
(3,275 Views)

mablab version is 2012a with 32bit. Yeah, if the matlab code is simple, the Labview can work correctly. And the matlab code can work correctly in matlab 2012a, but a little time-consuming. however, thank you for your comment.

0 Kudos
Message 5 of 6
(3,242 Views)

Bob,

  This is one of those RG things I do not like!  (Don't get me wrong! I like you and your code! just... well hear me out OK?)

Capture1.PNG

here we have a comparison driving a boolean case and the number is compared again to select an essentially boolean output (0,1)  The true case outputs a constant 0

 

Would not this be easier and hide less code in the unshown case?

Capture1.PNG

Note: the original code and the equality is added for comparision (Hey, I can make mistakes!)  but do you really need a case structure or a select for that?

 

The "Less Than 10" could be simplified too to "Not Equals 0" and the AND inversion removed but thats splitting hairsSmiley Wink

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 6
(3,225 Views)