LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I insert strings into an array? I tried to use the spreadsheet string to array block and it did not work.

Solved!
Go to solution

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:

Capture1.JPG

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.

Capture1.JPG

Download All
0 Kudos
Message 1 of 19
(5,215 Views)

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.

 

Snap19.png

VI is not included; by copying the above picture, you will at least learn a bit.

 

mcduff

 

 

0 Kudos
Message 2 of 19
(5,194 Views)

Filtering the channels can be done using the code below:

Filter Channels.png

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.

Lucian
CLA
0 Kudos
Message 3 of 19
(5,186 Views)

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.

Capture1.JPG

0 Kudos
Message 4 of 19
(5,151 Views)

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

0 Kudos
Message 5 of 19
(5,138 Views)

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.

 

Data filteredData filtered

 

mcduff

0 Kudos
Message 6 of 19
(5,136 Views)

I was able to delete all the channels with the word "MOD" a few hours later. Now, it is not working. I did not modify my block diagram. Has this ever happened to you, guys? How do you solve this problem? I attached my VI and the tdms file that I am using. Below is how my block diagram looks like.Capture1.JPG

Download All
0 Kudos
Message 7 of 19
(5,098 Views)

Go back at look at your earlier posts and the solution that was given to you. For it to work you need to copy it correctly. Also get rid of the read TDMS, you aren’t using it, so why have it.

 

Tutorials will make LabVIEW less crazy.

 

mcduff

0 Kudos
Message 8 of 19
(5,057 Views)

Hey,

This thread is different from the first one. In this one, I am trying to delete/remove the channels with the word "MOD" from the list of channels under the "thermocouples" group.

I copied what you posted then can you explain to me why am I  still getting the channels with the "MOD"?  .

This is what I did.

Capture1.JPG

Capture2.JPG

0 Kudos
Message 9 of 19
(5,040 Views)

Go back to the Tutorials and learn how to wire a Conditional Indexing Tunnel.  Notice the two (not one) words modifying "Tunnel", and remember the idea -- it is an Indexing Tunnel (which passes everything, as does your Indexing Tunnel, which is working correctly), but is modified by a simultaneous Conditional Input (which your Indexing Tunnel is missing).

 

Bob Schor

0 Kudos
Message 10 of 19
(5,031 Views)