From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling a task in a DAQmx with multiple tasks

Solved!
Go to solution

I am building a UI for engine tests and I am attempting to allow the user to disable a sensor if it isn't connected to the DAQ. Is there a way to zero the values of one DAQmx Create that is connected to others on one task so that it acts as a place holder in the waveform graphs and save matrices we have set up? My original thought was to trick each disabled channel into zeroing an enabled channel; but I am unsure how to zero the values before timing so that the times aren't zeroed.

 

I have attached an image that shows each DAQmx in boolean statements if enabled or not on the left and the matrix that splits the data for the graphs on the right (I apologize for the mess, this came from a file built a few years ago and I have been tasked with fixing parts).

I need each one to be a place holder when disabled so that matrix remains the same and I would like to not make a separate tasks because I will need to expand to 15 sensors later and a single task makes that easier.

Thank you in advance, I apologize if this was confusing in any way.

0 Kudos
Message 1 of 7
(2,544 Views)

I don't generally bother looking at images, particularly if they are pieces of a Block Diagram.  Attach VIs, and preferally your entire LabVIEW Project (compress the folder to make it a single .zip file first).

 

Bob Schor

Message 2 of 7
(2,497 Views)

I'll attach it, but program is about as disorganized as it can be, I wouldn't blame you for asking me why I didn't start over or not wanting to help. It took me almost a week to understand it before I could begin to simplify it into a cleaner program and it has a long way to go, I couldn't ask someone to go through it, the image was just as a clarification of what the area in question looks like and to correct any terminology I may have used improperly. Thank you for your response.

0 Kudos
Message 3 of 7
(2,485 Views)
Solution
Accepted by topic author Mrhighsky40

Zeroing a waveform datatype is as easy as multiplying it by zero. It'll zero all of the elements in the array.

 

About what sample rate are you using? If it's very high you might have to worry about signal ghosting when you read a disconnected channel.

 

If it's less than a few 10's of kHz I'd just try it out- instead of suppressing the Create Channel, just multiply it by 0 if that channel is disabled.

Message 4 of 7
(2,472 Views)
Solution
Accepted by topic author Mrhighsky40

@BertMcMahan wrote:

Zeroing a waveform datatype is as easy as multiplying it by zero. It'll zero all of the elements in the array.

 

About what sample rate are you using? If it's very high you might have to worry about signal ghosting when you read a disconnected channel.

 

If it's less than a few 10's of kHz I'd just try it out- instead of suppressing the Create Channel, just multiply it by 0 if that channel is disabled.


I'd rather not scale the disconnected sensor by 0.  That will give you an array of 0's for y[] and adds a nasty line on graphs and charts.   Instead, multiply by NaN :D!  The plot line disappears since the y[] values are all Not A Number.


"Should be" isn't "Is" -Jay
Message 5 of 7
(2,406 Views)

@JÞB wrote:

@BertMcMahan wrote:

Zeroing a waveform datatype is as easy as multiplying it by zero. It'll zero all of the elements in the array.

 

About what sample rate are you using? If it's very high you might have to worry about signal ghosting when you read a disconnected channel.

 

If it's less than a few 10's of kHz I'd just try it out- instead of suppressing the Create Channel, just multiply it by 0 if that channel is disabled.


I'd rather not scale the disconnected sensor by 0.  That will give you an array of 0's for y[] and adds a nasty line on graphs and charts.   Instead, multiply by NaN :D!  The plot line disappears since the y[] values are all Not A Number.


Good advice, but he did ask to "zero" the line 😉

 

(I always forget about NaN's not showing up, so thanks for the reminder!)

0 Kudos
Message 6 of 7
(2,395 Views)

@BertMcMahan wrote:

@JÞB wrote:

@BertMcMahan wrote:

Zeroing a waveform datatype is as easy as multiplying it by zero. It'll zero all of the elements in the array.

 

About what sample rate are you using? If it's very high you might have to worry about signal ghosting when you read a disconnected channel.

 

If it's less than a few 10's of kHz I'd just try it out- instead of suppressing the Create Channel, just multiply it by 0 if that channel is disabled.


I'd rather not scale the disconnected sensor by 0.  That will give you an array of 0's for y[] and adds a nasty line on graphs and charts.   Instead, multiply by NaN :D!  The plot line disappears since the y[] values are all Not A Number.


Good advice, but he did ask to "zero" the line 😉

 

(I always forget about NaN's not showing up, so thanks for the reminder!)


NaNs play nicer with "matrix" comparisons too since NaN fails any comparison to a number.  "Zeroing" a disconnected Sensor is more trouble than it is worth since you now have that "Real" Zero to contend with in any analysis.


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(2,355 Views)