Suleyman Posted April 12, 2007 Report Share Posted April 12, 2007 Hi guys, I want to save the values in Excel in coloumns en rows. But i don't know how. In the example below, you see that it save the values under each other in Excel en not in colums en rows. How can ik realise this. Can somebody help me please........ Greetings, Suleyman Appendix: Compare&Save.vi and Write.jpg Quote Link to comment
Dave Graybeal Posted April 12, 2007 Report Share Posted April 12, 2007 Suleyman, It was nice to see a VI showing what you were trying to accomplish. Between that, the screenshot and the description you formed what I feel was a good question. You were on the right track to get the data sorted into columns and rows. Attached is a VI that I built off your example to give you a pretty good idea as to how to go about getting the data formatted properly. One difference in the way I handled it was that I get everything into a 2D array (virtual table) before I write data to a spreadsheet file. This allows me to get it to look how I need it without having to think. I also notice that the way you have the VI set up it basically opens the file writes all the data and then closes the file each time you loop around. I'm not sure if this was intended, but I would recommend either doing all the writing outside of the loop at the end, or using the following procedure: 1) opening the file before going into the loop. 2) writing a single row of data to the file (for this you would use a tab delimiter for the array). 3) close the file after exiting the loop. I hope that this information helps you along your way. Dave Graybeal Quote Link to comment
Suleyman Posted April 12, 2007 Author Report Share Posted April 12, 2007 Thanks man, You gived me a good explaination. But i have a another question. How can i put text in it. Like this example Send Value Received Value 2 1,5 3 2,8 4 3,9 I have the value, but dont have the text. Quote Link to comment
Dave Graybeal Posted April 12, 2007 Report Share Posted April 12, 2007 Well, there are more than one way to put in a header. The first way that comes to my mind is just use a concatenate string. Since the data is arranged in a spreadsheet string its format is pretty much: data1[tab]data2[tab]data3[cr]data4[tab] ... etc. Tabs denote column changes and CR denotes a row change (Tab is actually a Tab and CR is a Character Return). So you can simple build your header as follows: Send Value[tab]Received Value[cr] then concatenate that on the front of the spreadsheet string before you write it to the file. I hope this helps. Dave Quote Link to comment
Ashish Uttarwar Posted April 12, 2007 Report Share Posted April 12, 2007 I don't see a reason to have a "while" loop. Attached VI is without while loop and it works too! Regards, Ashish 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.