Matlab data sorting question
조회 수: 1 (최근 30일)
이전 댓글 표시
I have been wokring with a dataset that I have examined using Matlab for some time. For whatever reason, the creators of the set decided that they were going to change IDs for many entries in the set. The two IDs of interest are specimen id and external sample id, and for most entries in the set at least one of these was changed. I was wondering if anyone had reccomendations on how to compare these two data sets and the old vs. new IDs to try and get a sense of which entries are linked to each other and which had values changed. I have attempted to do so but I tend to get lost in all the moving parts. Thanks!
댓글 수: 1
Star Strider
2024년 2월 22일
If only the IDs have changed and the accompanying data have remained the same, one option might be the ismember function on everything defining the data except the IDs, since you would likely be looking for an exact match. You would need to experiment to get the desired result.
답변 (1개)
Divyanshu
2024년 3월 5일
Hi Daniel,
A possible way to match and find out which entries from old-dataset are linked to which entries in new-dataset after updation of 'Specimen Id' & 'External Sample Id' is by identifying and using a third variable or column in the dataset which is unique and unchanged across old & new datasets.
Assuming that a third column with unique and unchanged values between old & new datasets exist, refer the following points:
- Create a dictionary data type and make the values of 'Col3' as keys of dictionary.
- Now iterate over the new dataset and push the 'Specimen Id' as value to the key.
- Iterate over the old dataset and for each value of 'Col3' fetch its value from dictionary which is corresponding new Id.
- Now you have both old Id and Updated Id which you can use or link.
Note: 'Col3' is the assumed third column with unique values in a set and those values are not changed between old & new dataset.
You can refer the following documentation for more details on 'dictionary':
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!