OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Need help with data manipulation in NeoOffice

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
Cham
Newbie
Newbie


Joined: 01 Aug 2008
Posts: 3

PostPosted: Fri Aug 01, 2008 6:30 pm    Post subject: Need help with data manipulation in NeoOffice Reply with quote

I need help with some data manipulation in NeoOffice. I am not an expert with spreadsheet apps Sad I have a LARGE bunch of mixed numbers (three cartesian coordinates) and text, like this very small sample :

Code:
vertices $
0.587341   -0.004852   0.809325
0.587344   0.003316   0.809330
0.589727   0.017470   0.807414
0.593521   0.029771   0.804268
linestrip $

vertices $
0.489287   -0.011868   0.872042
0.480151   -0.042015   0.876179
0.477583   -0.056780   0.876750
0.481149   -0.062965   0.874375
0.503490   -0.080895   0.860206
0.505628   -0.091953   0.857838
0.506437   -0.106646   0.855657
linestrip $



I need to replace each $ with the number of points (an integer) enclosed within the words "vertices" and "linestrip". In this example, I want to get this :

Code:
vertices 4
0.587341   -0.004852   0.809325
0.587344   0.003316   0.809330
0.589727   0.017470   0.807414
0.593521   0.029771   0.804268
linestrip 4

vertices 7
0.489287   -0.011868   0.872042
0.480151   -0.042015   0.876179
0.477583   -0.056780   0.876750
0.481149   -0.062965   0.874375
0.503490   -0.080895   0.860206
0.505628   -0.091953   0.857838
0.506437   -0.106646   0.855657
linestrip 7



Next, I need to replace each empty line below the "linestrip" with integers from 0, 1, 2, ... to $-1, like this :

vertices 4
Code:
0.587341   -0.004852   0.809325
0.587344   0.003316   0.809330
0.589727   0.017470   0.807414
0.593521   0.029771   0.804268
linestrip 4
0
1
2
3

vertices 7
0.489287   -0.011868   0.872042
0.480151   -0.042015   0.876179
0.477583   -0.056780   0.876750
0.481149   -0.062965   0.874375
0.503490   -0.080895   0.860206
0.505628   -0.091953   0.857838
0.506437   -0.106646   0.855657
linestrip 7
0
1
2
3
4
5
6

Someone knows how to do this, in OpenOffice (I'm using the OS X version) ?
Back to top
View user's profile Send private message
RickRandom
Super User
Super User


Joined: 27 Jan 2006
Posts: 1082
Location: UK

PostPosted: Sat Aug 02, 2008 12:01 am    Post subject: Reply with quote

It's a bit clumsy, but:

With the first word "vertices" in cell A2, and the data in columns A, B and C:

Put in D2:

=if(A2="vertices";0;if(A2="linestrip";D1;if(and(A1="linestrip";isblank(A2));0;D1+1)))

and copy down as far as necessary.

Put in E2:

=if(A2="vertices";vlookup("linestrip";A3:$D$21;4;TRUE);if(A2="linestrip";D1;if(isnumber(B2);B2;D2)))

and copy down as far as necessary. (Adjust the $D$21 to cover the size of your data.)

This gives you a new column to use instead of column B.

Let us know if this works, but I think this would be better done in a programming language (not that I could do it. Embarassed )
Back to top
View user's profile Send private message
Cham
Newbie
Newbie


Joined: 01 Aug 2008
Posts: 3

PostPosted: Sat Aug 02, 2008 5:34 am    Post subject: Reply with quote

Thanks a lot for your reply !

The first instruction (in D2) is working, apparently. At least, it's giving me a column of integers... But when I insert the other instruction in cell E2, I'm getting a #NAME? and I'm unable to get it to work (this is one thing I never understood clearly in OpenOffice).

Also, should I remove all the $ in my data ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group