Get new variable with elements from a double matrix & cell array given a specific condition
Ältere Kommentare anzeigen
I am working with Matlab, and I have a cell array with 5 columns and half million rows and a double matrix with columns and about a quarter million rows. Let’s call them A and B. A has both string and number elements.
There is one element that is common in both cells, although the number of rows and order is not equal. What I would like is to obtain a new variable (double or cell) with X columns from the cell array A and double matrix B every time a condition is verified. The condition would be if column Y (from A) and Z (from B) match. For instance: Cell array A:
'19970102' '00000127' 'MORRISON' '00148' 'BA'
'19970102' '00010121' 'GALLITANO A' '00001382' 'ALEX'
'19970102' '00031783' 'HOPSON' '00039' 'EDW'
'19970102' '00040486' 'STRUM' '00003' 'CHI'
'19970102' '00003337' 'KATICA H' '00001929' 'RAYMOND'
Double Matrix B:
19970101 31783 183
19970101 127 235
19970101 18290 183
19970101 835 01
19970101 40486 1976
What I would like to get in the ‘new’ variable:
19970101 31783 183 '19970102' '00031783' 'HOPSON' '00039' 'EDW'
19970101 127 235 '19970102' '00000127' 'MORRISON' '00148' 'BA'
19970101 18290 183
19970101 835 01
19970101 40486 1976 '19970102' '00040486' 'STRUM' '00003' 'CHI'
Can anyone help me? Thanks a lot for your availability.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!