Sorting excel data (numbers and strings) and outputting sorted data to another excel file.
Show older comments
I have a rather large excel data file that I would like to sort. My goal is to sort the data in three different columns. Two columns are based on keywords within large sentences and one column is just numbers. There are 10 different keywords and 20 different numbers I need to sort with. I would then like the entire row of each row that meets the requirements of keywords and numbers to be placed in a separate excel file.
I am very new to MATLAB and have been struggling with this for some time now. Any help provided would be greatly appreciated.
Kind regards,
14 Comments
connor mcgarry
on 13 Sep 2017
Stephen23
on 14 Sep 2017
@connor mcgarry: you can easily create some sample data that has all of the properties of your confidential data, and upload that.
connor mcgarry
on 25 Sep 2017
Edited: connor mcgarry
on 25 Sep 2017
@connor mcgarry: Note that a PDF is not an Excel worksheet, and is almost impossible to get any meaningful data out of. A PDF does not have "all of the properties of your confidential data" as you were requested to provide. A PDF has all of the properties of a PDF: nice to look at but useless for storing data.
No one is going to sit a copy out your data from a PDF. If you want help then provide us with some data.
connor mcgarry
on 26 Sep 2017
Data extraction heavily relies on the structure of the content and the nature of the data. We have to understand what characters we should expect, what delimiters, whether there are spaces and where, what kind of numbers are present, etc, etc, etc.
Whatever are the restrictions on your data, they don't prevent you to alter the content and share some slice. We need to know the content better; if you have
Name Age Diseases/status # treatments Dates
Dana 57 Hodgkin lymph. [32], Septicemia [27] 3 28/03/2009, 17/12/2012
change it for
Name Age Some label # label Dates
John 23 Sever fever [13], itching feet [102] 29 10/01/2001, 11/07/2010
and we can get the information that we need from there. You can change numbers, names, keywords, whatever, but there is no point for us to spend time explaining little by little general approaches and refine the answer each time you drop a little element of information.
connor mcgarry
on 26 Sep 2017
No problem, we don't need thousands of lines either, but provide an example that captures the possible variations. To illustrate, if a cell can contain nothing, a single word, or more words separated by commas, there is no point in giving three lines that contain more than 10 words because we don't get that there can be a single or none. In such case, pick one line with an empty cell, one with a single word, and one line with more words, so we have all the information/cases.
connor mcgarry
on 27 Sep 2017
Edited: connor mcgarry
on 27 Sep 2017
But see you altered the content of the column that you want to parse not just by changing values. When I see:
"Date: 2015-08-12Text: #100331835 this portion contains text and numbers that are imprtant. The dates within this column are not important. I wish to search for keywords and also numbers mixed with letters. 78034421KJ, C346E, C234A-01, and F23G-02 are some examples of numbers that I wish to search for. There is usually a large amount of information in the form of text with punctuation (ie. () or,) and a much smaller amount of information in numbers."
in a cell, I don't know it if there will be one of more dates, if they start with "Date: " including a white space, if the text is preceded by "Text: ", I don't know either if these keywords are separated by commas, etc.
Don't insert explanations in your data set. Update some values so you are fine regarding the confidentiality and don't touch the rest.
We'll get there ;-) it's just that you don't understand yet what we are using for parsing content.
connor mcgarry
on 27 Sep 2017
connor mcgarry
on 29 Sep 2017
Cedric
on 29 Sep 2017
I'll answer in the comments under my answer.
Accepted Answer
More Answers (0)
Categories
Find more on Text Data Preparation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!