- 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.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Devang Anadkat
am 13 Mär. 2021
Kommentiert: Devang Anadkat
am 13 Mär. 2021
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 Kommentare
Akzeptierte Antwort
Jan
am 13 Mär. 2021
3 Kommentare
Jan
am 13 Mär. 2021
Bearbeitet: Jan
am 13 Mär. 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...
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!