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.

Students Click Here

Trying to collect info from csv file

Trying to collect info from csv file

Trying to collect info from csv file


I am trying to use the textscan command to work a csv file we generate on a test stand.
First I have 115 strings as headers, for this I thought of:

C_text = textscan(fid, '%s', 115, 'delimiter', ',');

I need to ignore/erase the first two. I find it unpractical to write the 113 %s and the two %*s.
Any ideas?

Then I am thinking on getting the results (below each of the 113 strings) , strings and numbers, to start working on them for statistical analysis (histogram, percent failures, codes, etc). For this data, the first 4 are strings, then f f, then s,  f f f ..113th f.

Something like this:


I do not want to right down the hole chain, any ideas?

I am attaching the file so you can take a look. The final purpose is to pull each file for every day and not waste time trying to make the summary of the results.

I appreciate your help.

RE: Trying to collect info from csv file

Found some code.
I will need to change the number of rows depending on the size of the file.

From the data already gathered, I am on a dilema, should I create a separate variable from each column to easly start plotting them or should I work out each of the variables at "data" ? Please take a look to the code and let me know your thoughts.  Is it possible to have at the x axis both date/time  and Serial Number (obviously, matched) ? how can I change the scale of the y axis ?

function data=dataimport
% Import data from DRC_50HP_Stand1_090406.csv
% Automatically generated 08-Apr-2009

% Define parameters

% Read data from file

% Convert to 2D Cell
data=cell(numRows+1,length(dataCell)); %Preallocate
data(1,:)=columnNames; % Start with column names

for k=1:length(dataCell)
    if iscell(dataCell{k}) % If cell array of strings
    else % If numerical

I really appreciate your help, thanks

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! Already a Member? Login


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