Get new variable with elements from a double matrix & cell array given a specific condition
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!