12-21-2019 02:47 PM
So I am reading channels from a TDMS file and I would like to insert only channels that contain words "Mod" into array so that it looks like the picture below:
Below is my block diagram (I do not know how to fix that broken wire). Also, I attached my VI and the tdms file that I'm reading data from.
Solved! Go to Solution.
12-21-2019 03:10 PM
You have been on this board for over two months, it is about time you started taking some tutorials. Look at your VI, it makes little sense. You connected an array to a string, hence the broken wire.
You have a loop to index elements of an array. You are reading the whole array every loop and then picking out an element to see if it has Mod in it.
Read the array once, (All that TDMS stuff should be outside the loop), then loop through the elements of the array to find values you want, like below.
VI is not included; by copying the above picture, you will at least learn a bit.
mcduff
12-21-2019 03:16 PM
Filtering the channels can be done using the code below:
Search/split string function breaks the wire because it does not accept an array as an input and cannot return an array as an output. If you can give more details about what you want to achieve maybe we can give some guidance because the code that you attached does not make too much sense.
12-21-2019 03:47 PM
The TDMS has a lot of channels, but I am only trying to insert channels that have the word "Mod" array such that the array looks like the one below. I am trying to achieve it using search/split string. If you have a different way or know the best way to do it, please share it. I'm here to learn that's why I am asking questions. I don't know everything and no one can claim to know everything.
12-21-2019 03:56 PM
McDuff's Response (#2) showed you the method. Start with an Array of Strings. Run it through a For loop (which lets you work with a single element). Do your test (here a simple Search String). If you don't know how Search String works (and how it can detect if "Mod" is or is not present), right-click the Function and read its Detailed Help. Finally, use this information to return a value to the output Indexing Tunnel only if the Condition is met. If you don't understand Conditional Tunnels, go through the Tutorials on For Loops and Arrays and Tunnels again.
Bob Schor
12-21-2019 04:01 PM
I'm here to learn that's why I am asking questions. I don't know everything and no one can claim to know everything.
Asking questions is fine; but you are asking basic questions. You would be better served if you took some time to learn on your own. You will have an Eureka moment, where it all comes together.