ni.com is currently experiencing slowness/issues due to ongoing maintenance.
Support teams are actively working on the soonest resolution.
ni.com is currently experiencing slowness/issues due to ongoing maintenance.
Support teams are actively working on the soonest resolution.
11-17-2010 06:53 AM - edited 11-17-2010 06:55 AM
Hello guys!
Today I got into a bit of mess when making a program for my company. I'm reading from a .csv file which is containing information regarding electric components. I have to read the cell into an array for further use. No problem at all.
Now the hard part:
Lets say a cell in the .csv file contained this: C1-C10
I put it into an array and still have: C1-C10
(C1-C10 means there are actually ten cmponents; C1, C2, C3...C10)
I now want to convert the array containing C1-C10 into an array looking like this:
C1
C2
C3
.
.
.
C10
(Se attachment LV2010)
I think a solution is to remove the C from the string and then look at the numbers and find out how many components there are. Then put it back with a C in front and create ten incrementing numbers like this:
C1-C10 => 1-10 = Ten elements => Create numbers: 1,2,3,4,5,6,7,8,9,10 => Add C in front of the numbers.
Anyways this algorithm has to be capable for any letters and numbers, i.e. R2-R5, K2-K7 etc...
Anyone which has done a similar thing and maybe can help me in the right direction on where to start?
Solved! Go to Solution.
11-17-2010 07:37 AM
Here is my attempt. I split the string at "-" with Match Pattern and then search each substring for leading letters. Use the numeric parts to create an array of integers and convert back to strings.
Lynn
11-17-2010 07:38 AM
11-17-2010 07:47 AM
Here is my VI saved back to LV8.0. The original VI just had the Array to Spreadsheet String part at the top.
Lynn
11-17-2010 08:14 AM
11-17-2010 08:46 AM
11-17-2010 09:16 AM
11-17-2010 10:56 AM
I explained the regular expression here.
11-17-2010 11:11 AM
I explained the regular expression here.
Jim, CLD
Hi Jim,
This is awesome !
Thanks ! I learned a lot today thanks to you and your example.
Regards,
11-17-2010 11:14 AM
@helmut O'Brian wrote:
Thanks ! I learned a lot today thanks to you and your example.
Regards,
You're welcome. I learned everything I know from the link in my signature and Darin.K.