Jump to content

Save in Excel


Recommended Posts

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

Link to comment

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

Link to comment

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

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.

Guest
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.