Jump to content

Splitting Column in Array


Recommended Posts

I'm not really sure what forum to put this under, but here is what I need to do:


As of right now I have a  n-row, 7 column array.  It is read from a .csv file and then my code prints it out on the screen in a string array.  One of the columns is called difference, which has a difference between two of the others then shows the percent difference that is... the form it shows it would be .0088(.020%).  I need to create two different columns, one for the numerical difference and one for the percent difference and then make a new array which is n-rows by 8 columns replacing these two.  


I really dont know where to go with this, I've tried a few approaches and none have come even close. I'm sure this is probably not very difficult to do but I am new to LabVIEW and have only just started coding projects that were not tutorials in it.



So... for example to show what I need:



Number 1      Number 2     Difference                                                          Number 1        Number 2     Difference     Percent


10                        1              9(90%)                                                                   10                   1                    9                10

20                        2              18(90%)                                                                  20                   2                   18              90



Link to comment

Here is what I have so far... I have been working for a while and as of right now the array I read the difference percentage into writes the value in the right index but immediately erases it the next iteration so right now I am trying to solve that... any help would be appreciated



edit: used the scan from string to replace the middle part there

Edited by seanscal
Link to comment

You don't use the auto-indexing feature of the outer For loop and the inner For loop isn't doing anything.  If you right-click on the pink tunnel on the left edge of the loop and select 'Enable Indexing', you'll be able to remove the 'Array Size' and 'Index Array'.


I see you edited your post since I last looked at it.  Here's what I've done:



  • Like 1
Link to comment

Im not sure how you do the smaller picture like that but in case anyone else ends up having this problem, this is how I solved it... I havent yet put it in one single array but do now have the two separate columns... My data did not let me use the scan from string because apparently some rows in some files are blank and I had not noticed.


This code may not be extremely streamlined but it did achieve the two columns I wanted.


Thank you for the help jcarmody


Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.