LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using matlab script

Hello!
 
I'm using matlab script block in my aplication. The m-file (from matlab) contain an 'if' that depends of an input of labview.
 
I want to pass trough this condition only once when input's value changes, but labview "covert" this 'if' in a 'while' and pass trough this sequence n times.
 
How can I to impose to pass throug the sequence once the input's value change. It's better to specifie it from matab or from labview.
 
Thank you in adavance 
0 Kudos
Message 1 of 4
(2,884 Views)

If this is occuring in a while loop in LabVIEW you can put a shift register on the border of the while loop and feed the value into it. Then you can have a case statement inside the while loop, with one case just passing the value through to the shift register if the value hasn't changed (OldValue = NewValue), and the other case triggered on a value change (OldValue /= NewValue).

P.M.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 4
(2,882 Views)

Hello LV_Pro,

I'm not using a while loop. I'm using a matlab script block...in this block I've imported a m-file from matlab that contains the sequence if. But when I run this block, labview pass trough this sequence a lot of times (like a while but it's not a while). What can i do eith matlab script block to pass trough this sequence once the input value changes.

 

Thank you

0 Kudos
Message 3 of 4
(2,874 Views)

What is surrounding the matlab script block? LabVIEW should be modifying the matlab code, it should be connecting with matlab and matlab executes its code, returning the results to LabVIEW. Can you do a screen capture of the part of the code that contains the matlab stuff? If yes make sure that it is saved as a .jpg (not .bmp!) for size reasons. If not, if you can send the part of your code that includes the matlab stuff that would help.

P.M.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 4 of 4
(2,859 Views)