Re: Table algorithm help needed
- From: rossum <rossum48@xxxxxxxxxxxx>
- Date: Tue, 12 Apr 2005 22:16:06 +0100
On Tue, 12 Apr 2005 01:33:27 GMT, BCC <bcc@xxxxxxxx> wrote:
>Hi,
>
>I have a table that is in this form (in csv format):
>
>ExpId1,,,
>Samp1,1,2,3
>Samp2,1,3,4
>Samp3,2,3,5
>ExpId2,,,
>Samp1,3,5,6
>Samp2,6,7,9
>
>And I need to (in c++) convert it to this format:
>ExpId1,,,,ExpId2,,,
>Samp1,1,2,3,Samp1,3,5,6
>Samp2,1,3,4,Samp2,6,7,9
>Samp3,2,3,5,,,,
>
>Basically instead of appending rows, I need to append columns. Anyone
>know a good way to do this?
>
>B
First work out how to separate the different sections so you can read
them in and store them separately:
ExpId1,,,
Samp1,1,2,3
Samp2,1,3,4
Samp3,2,3,5
Separate here
ExpId2,,,
Samp1,3,5,6
Samp2,6,7,9
You will need to think about some sort of extensible data structure to
hold the data as you read it in from the csv file.
Once you have the sections separated out and stored then concatenate
the first lines in all sections with extra commas and output. Same
with the second lines and so on. You might need dummy lines of just
commas if some sections have less lines than others.
HTH
rossum
The ultimate truth is that there is no ultimate truth
.
- References:
- Table algorithm help needed
- From: BCC
- Table algorithm help needed
- Prev by Date: Re: Comments suck [Was: Length of variable names affect performance?]
- Next by Date: What is the data structure for road map??
- Previous by thread: Re: Table algorithm help needed
- Next by thread: Re: Table algorithm help needed
- Index(es):