- Import the files. (Is this a part of your problem?)
- Search the intersection of the common variable with the command intersect . The 2nd and 3rd output give you the overlapping indices.
Comparison of two unequal length files.
5 views (last 30 days)
Show older comments
I have two .csv files of unequal length. each file has two colomns and one has 50000 rows and other has 27000 rows. in this first colomn is of wavelengths and other is of intensity. I want to get data in which the wavelengths of both files are equal and also want corrsponding intensities. so how can i find it using program?
thanking you in advance.
0 Comments
Accepted Answer
Jan
on 13 Mar 2021
3 Comments
Jan
on 13 Mar 2021
Edited: Jan
on 13 Mar 2021
I do not know, how the intensities are represented. Did you mention, if you your data are matrices with a specific number pof columns? A small example would be useful. With some guessing:
A = [1; 3; 2; 17] % 1st file
B = [0, 0.1; 1, 0.2; 2, 0.3; 3 0.4; 17, 0.5; 24, 0.6]; % 2nd file
[Common, iA, iB] = intersect(A, B(:, 1));
CommonIntesity = B(iB, 2)
A(iA, 2) = B(iB, 2) % Maybe wanted...
More Answers (0)
See Also
Categories
Find more on Workspace Variables and MAT-Files 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!