Can I save a row of data that has numeric and non-numeric elements?

2 views (last 30 days)
I have several data files (samples) that I need to process individually. The result is numeric values in a row. What I would like is to have the file name at the beginning of each row and be able to save the file so that I can append it after I process each sample.
Is there anyway to create a variable that can be saved to a file (that can be appended) that contains both numeric and non-numeric elements?
This is what I'm trying to end up with:
Sample_1 v1 v2 v3
Sample_2 v1 v2 v3
Sample_3 v1 v2 v3
thanks,
Michael

Answers (2)

the cyclist
the cyclist on 11 May 2013
Cell arrays are designed to hold mixed-type data.
S = {'Sample_1',1, 2, 3}
See this documentation for lots more info:

Michael
Michael on 11 May 2013
Thats worked to set up a row with the sample name at the beginning, however, I can't save it now matter what I try. I CAN copy and paste to an excel sheet but I have 4 hundred or so to so and was hoping to streamline the process as much as possible.
The other issue I'm finding is that I'm taking the sample name from the filename and so it looks like this:
S = {name_of_file, v1, v2}
and not like
S = {'sample_1', v1, v2}
I'm finding this leads to other problems.
Thanks for your help
Michael
  2 Comments
Image Analyst
Image Analyst on 11 May 2013
I don't think he can delete his "answer" (which should have been a comment) if someone has responded to it.
the cyclist
the cyclist on 12 May 2013
Michael, I'm pretty sure you should be able to accomplish what you want. Here is what I suggest. Your original question really did not give enough detail on what you wanted to do. (For example, you just said "save to a file", but what you really wanted was to write Excel.)
In rereading your question and then the other detail you added later, it is frankly still not clear what you are trying to do. I suggest you abandon this question and start a new one, really trying to focus on a very clear and specific outline of what you want. Remember, we don't know anything other than what you tell us.

Sign in to comment.

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!