Marcus_tribscan Posted November 16, 2010 Share Posted November 16, 2010 Hello, I'm logging two channels, A and B, which I also present in two separate graphs. I also have a third graph presenting the quotient A/B. Now to my question; if the value of A is under a certain limit (in the example below = 0.2) I would like the third graph (A/B) to display 0. Here's what I've tried without any success: I've created a sequence (set to auto-start with thread priority 5): ____ global quotient = 0 if (A[0]) < 0.2 quotient = 0 else quotient = A[0]/B[0] endif ____ I then try to call the quotient variable by just writing "quotient" in the y-expression field from within the third graph but this does not seem to work. Please help... Marcus Link to comment Share on other sites More sharing options...
AzeoTech Posted November 17, 2010 Share Posted November 17, 2010 Yeah, that won't work because quotient is a scalar, among other reasons (such as the fact that your sequence isn't looping). The best way to do this is with simple boolean math directly in the Y Expression: A/B * (A >= 0.2) The boolean (A >= 0.2) will return an array of 0's and 1's, with 1 everywhere its >= 0.2. Multiply by A/B which is an equal sized array and you get 0 wherever A < 0.2 Link to comment Share on other sites More sharing options...
Marcus_tribscan Posted November 18, 2010 Author Share Posted November 18, 2010 That did the trick, thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.