seanscal Posted August 12, 2013 Report Share Posted August 12, 2013 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 Quote Link to comment
jcarmody Posted August 12, 2013 Report Share Posted August 12, 2013 I've tried a few approaches and none have come even close Upload what you've done and we can help you along. Here's a hint to get two columns out of the 'Difference'. Quote Link to comment
seanscal Posted August 12, 2013 Author Report Share Posted August 12, 2013 (edited) 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 August 12, 2013 by seanscal Quote Link to comment
jcarmody Posted August 12, 2013 Report Share Posted August 12, 2013 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: 1 Quote Link to comment
seanscal Posted August 12, 2013 Author Report Share Posted August 12, 2013 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 Quote Link to comment
jcarmody Posted August 12, 2013 Report Share Posted August 12, 2013 I'm glad you got what you needed, but you ignored the first paragraph in my previous post. Quote Link to comment
seanscal Posted August 12, 2013 Author Report Share Posted August 12, 2013 (edited) I had already gotten it this way before I saw that, I'm going to save a copy of this now and try doing what you said Edit: Works perfect and is significantly neater now. Thank you!! Edited August 12, 2013 by seanscal Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.