INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

CSV Data Manipulation

CSV Data Manipulation

(OP)
Could someone suggest how I can manipulate a cell in a csv file which contains 4 sets of values from a GCDC X16-4 accelerometer Time,Ax,Ay,Az and divide only the Ax,Ay,Az values by 2048 and then keep the output format the same with the Time,Ax,Ay,Az within the one cell.

RE: CSV Data Manipulation

Quote:

how I can manipulate a cell in a csv file

.csv TEXT files do NOT have cells.

I fail to understand.

If, however, you are using Excel to open a .csv TEXT file, which is really a bad idea (just because you CAN hit your thumb with a hammer, does not mean that you SHOULD) I'd suggest posting your question at Eng-Tips sister site, http://www.tek-tips.com/threadminder.cfm?pid=68, where Excel questions like this can be addressed.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: CSV Data Manipulation

".csv TEXT files do NOT have cells"

When read by Excel, they map directly into Excel's cell structure, so the 4th CSV values on each line will wind up in column D.

What I would do is
> read the file into Excel
> type 2048 somewhere away from the 4 columns
> do a Copy of the 2048 cell
> Paste Special/Divide columns B,C, and D
> delete the 2048 value
> save as a CSV

If necessary, these operations can codified in a macro

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

RE: CSV Data Manipulation

(OP)
Thank you for your help very much appreciated

RE: CSV Data Manipulation

2
@IRstuff,

A text file has no cells. And as I stated, if the OP were opening the text file with Excel, it is a very bad idea to do so. Excel can and will change data unless you protect your data be taking charge of the conversion. That is why one should IMPORT data into an existing workbook/worksheet, using the parsing and converstion features in the Import dialog.

Unintended converstions that could happen if a text file is opened with Excel:
1/2      Becomes   Date Jan 2 of current year
1:2      Becomes   Time 1:02:00
12E3     Becomes   12,000
01234    Becomes   1234
 

However, by using the Data > Get External Data > From Text... using a delimited import with COMMA as delimiter and specifying the appropriate Column Data Format, these conversions can be avoided.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: CSV Data Manipulation

Yes it does, BUT you might not get the results you expect when your data is changed on open if you ever have data similar to the examples I posted.

Just because you can does not mean that you should.

I rarely open a text file with Excel for this very reason. I IMPORT. Since most of my work was in a production environment, IMPORT, once established, can simply be refreshed to import fresh data, retaining all the data conversion protection previously applied.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: CSV Data Manipulation

just write a little routine in VB for applications, available within the excel suite

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close